Module
Yoga.Om.WorkerBees
- Package
- purescript-yoga-om-workerbees
- Repository
- rowtype-yoga/purescript-yoga-om-workerbees
#WorkerPool Source
type WorkerPool input output = WorkerPool input outputWorker pool handle
#PoolConfig Source
type PoolConfig = { numWorkers :: Int, workerPath :: String }Configuration for a worker pool
#defaultPoolConfig Source
defaultPoolConfig :: String -> PoolConfigDefault pool configuration (4 workers)
#makePool Source
makePool :: forall ctx errs input output. Sendable input => Sendable output => PoolConfig -> Om ctx errs (WorkerPool input output)Create a worker pool. Must be paired with terminatePool.
#makePoolWithData Source
makePoolWithData :: forall ctx errs input output a. Sendable input => Sendable output => Sendable a => PoolConfig -> a -> Om ctx errs (WorkerPool input output)Create a worker pool with shared data accessible to all workers via workerData.
#terminatePool Source
terminatePool :: forall ctx errs input output. WorkerPool input output -> Om ctx errs UnitTerminate a worker pool and all its threads.
#distributeWork Source
distributeWork :: forall ctx errs f input output. Traversable f => Sendable input => WorkerPool input output -> f input -> Om ctx errs (f output)Distribute work across the worker pool in parallel. Each input is submitted to the pool and processed by the next available worker.
Re-exports from Node.WorkerBees
#Sendable Source
class Sendable (a :: Type) Only Sendable things can be sent back and forth between a worker thread and its parent. These include things that are represented by JavaScript primitives. Arbitrary PureScript values cannot be sent, but variants, records and newtypes of these things can. If you have a newtype of some Sendable, you must wrap it.
Instances
Sendable IntSendable NumberSendable StringSendable Boolean(Sendable a) => Sendable (Array a)(Sendable a) => Sendable (Object a)(RowToList r rl, SendableRowList rl) => Sendable (Record r)(RowToList r rl, SendableRowList rl) => Sendable (Variant r)Sendable (SendWrapper a)Sendable JsonSendable UnitSendable VoidSendable ArrayBuffer(Fail (Beside (Quote a) (Text " is not known to be Sendable"))) => Sendable a
Re-exports from Yoga.Om.WorkerBees.SharedInt
Re-exports from Yoga.Om.WorkerBees.SharedMap
Re-exports from Yoga.Om.WorkerBees.SharedState
- Modules
- Examples.
FibonacciDemo - Examples.
SharedCounterDemo - Examples.
SharedMapDemo - Examples.
SharedStateDemo - Examples.
Workers. CounterWorker - Examples.
Workers. FibonacciWorker - Examples.
Workers. HashWorker - Yoga.
Om. WorkerBees - Yoga.
Om. WorkerBees. Atomics - Yoga.
Om. WorkerBees. SharedArrayBuffer - Yoga.
Om. WorkerBees. SharedInt - Yoga.
Om. WorkerBees. SharedMap - Yoga.
Om. WorkerBees. SharedState