Worker class

Constructors

Worker()

Properties

hashCode int
The hash code for this object.
no setterinherited
id Int
final
name String
Name of the worker, as specified in Worker.start or "worker $id" by default,
final
platformThreadId ULong
Get platform thread id of the worker thread.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

asCOpaquePointer() → COpaquePointer?
Convert worker to a COpaquePointer value that could be passed via native void* pointer.
execute<T1, T2>({required TransferMode mode, required T1 producer(), required T2 job(T1)}) Future<T2>
Plan job for further execution in the worker.
executeAfter(void operation(), {Long afterMicroseconds = 0}) → void
Plan job for further execution in the worker.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
park({Boolean process = true, Int timeoutMicroseconds = 0}) Boolean
Park execution of the current worker until a new request arrives or timeout specified in timeoutMicroseconds elapsed.
processQueue() Boolean
Process pending job(s) on the queue of this worker. Note that jobs scheduled with executeAfter using non-zero timeout are not processed this way.
requestTermination({Boolean processScheduledJobs = true}) Future<void>
Requests termination of the worker.
toString() String
String representation of the worker.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

activeWorkers List<Worker>
Get a list of all unterminated workers.
no setter
current Worker
Return the current worker.
no setter

Static Methods

fromCPointer() Worker
Create worker object from a C pointer.
start({Boolean errorReporting = true, String? name}) Worker
Start new scheduling primitive, such as thread, to accept new tasks via execute interface.