Module
Node.WorkerBees.Aff.Pool
- Package
- purescript-node-workerbees
- Repository
- natefaubion/purescript-node-workerbees
#WorkerPool Source
newtype WorkerPool i o
#make Source
make :: forall a i o. Sendable a => Sendable i => Worker a i o -> a -> Int -> Aff (WorkerPool i o)
Creates a new WorkerPool of some size. Worker threads will steal inputs as they become available to do more work. It's assumed that a worker is only processing one input, and yielding a corresponding output at a time. If a worker may yield multiple results for a single input, you should not use a worker pool.
#terminate Source
terminate :: forall i o. WorkerPool i o -> Aff Unit
Terminates the pool and any propagates an exception to any pending invokers.
#invoke Source
invoke :: forall i o. Sendable i => WorkerPool i o -> i -> Aff o
Submits a new input to the worker pool, and waits for the reply.
#poolTraverse Source
poolTraverse :: forall f a i o. Sendable a => Sendable i => Traversable f => Worker a i o -> a -> Int -> f i -> Aff (f o)
Traverses some input using a pool of some size.