isolate_pool_2 library

Classes

Action
Inherti when using pooled instances and defining actions. Action objects are holders of action type and payload/params when calling pooled intances
CallbackIsolate<R, A>
This class allows spawning a new isolate with callback job (CallbackIsolateJob) without using isolate pool
CallbackIsolateJob<R, A>
Derive from this class if you want to create isolare jobs that can call back to main isolate (e.g. report progress)
IsolatePool
Isolate pool creates and starts a given number of isolates (passed to constructor) and schedules execution of single jobs (see PooledJob) or puts and keeps their instacnes of PooledInstance allowing to comunicate with those. Job is a one-time object that allows to schedule a single unit of computation, run it on one of the isolates and return back the result. Jobs do not persist between calls. Pooled instances persist in isolates, can store own state and respond to a number of calls.
PooledInstance
Subclass this type in order to define data transfered to isalte pool and logic executed upon object being transfered to external isolate ([init method)
PooledInstanceProxy
Instance of this class is returned from IsolatePool.createInstance and is used to communication with PooledInstance via Action's
PooledJob<E>
One-off operation to be queued and executed in isolate pool Whatever fields are dedfined in the instance will be passed to isolate. The generic type E determines the return type of the job. Be considerate of Dart's rule defining what types can cross isolate bounaries, i.e. you will have challenges with objects that wrap native resources (e.g. fil handles). You may reffer to Dart's SendPort.send for details on the limitations.

Enums

IsolatePoolState
Isolate pool can be in 3 states: not started, started and stoped. Stoped pool can't be restarted, create a new one instead

Typedefs

PooledCallbak<T> = T Function(Action action)
Use this function defitition to set up callbacks from the isolate pool