Safe Haskell | None |
---|
This module defines a worker Neuron
which evaluates IO
actions it receives. It is useful to offload lengthly IO
actions
into another thread. In the case of too many queued IO
actions they are silently dropped and only newest ones are evaluated.
You grow
it in Incubation
by using something like:
nerveWorker <- (growNeuron :: NerveOnlyFor WorkerNeuron) defaultOptions
It is an example of a Neuron
which defines getNeuronMapCapability
. It processes only the newest Impulse
s it receives, when
they get queued, so Impulse
s are dropped if load is too high.
- data WorkerNeuron
- type WorkerFromImpulse = NeuronFromImpulse WorkerNeuron
- data WorkerForImpulse = Work {}
- type WorkerOptions = NeuronOptions WorkerNeuron
- type WorkType = IO ()
Documentation
data WorkerNeuron Source
type WorkerFromImpulse = NeuronFromImpulse WorkerNeuronSource
Impulse
s from WorkerNeuron
. This Neuron
does not define any Impulse
s it would send, NoImpulse
.
data WorkerForImpulse Source
Impulse
s for WorkerNeuron
.
Work | |
|
type WorkerOptions = NeuronOptions WorkerNeuronSource
Options for WorkerNeuron
. This option is defined:
mapOnCapability ::
NeuronMapCapability
- How to map the
Neuron
on capabilities (OS threads). With this option you can fix multipleNeuron
s on the same capability (for example, by generating one value withmkNeuronMapOnRandomCapability
and using it for all thoseNeuron
s) which is sometimes necessary when dealing with external (FFI) libraries. Default value isNeuronFreelyMapOnCapability
.