Module

Node.WorkerBees.Aff

Package
purescript-node-workerbees
Repository
natefaubion/purescript-node-workerbees

#spawn Source

spawn :: forall a i o. Sendable a => Worker a i o -> a -> Aff (Tuple (WorkerThread i) (AVar (Either Int o)))

Instantiates a new worker thread. If this worker subscribes to input, it will need to be cleaned up with terminate, otherwise it will hold your process open. Yields a WorkerThread instance, and an AVar which can be polled for results. Polling the AVar may result in an exception, and if the worker has just exited, will yield an exit code.

#post Source

post :: forall i. Sendable i => i -> WorkerThread i -> Aff Unit

Sends some input to a worker thread to process.

#terminate Source

terminate :: forall i. WorkerThread i -> Aff Unit

Terminates the worker thread.