inline class Worker
Class representing worker.
val id: Int
Plan job for further execution in the worker. operation parameter must be either frozen, or execution to be
planned on the current worker. Otherwise IllegalStateException will be thrown.
With -Xworker-exception-handling=use-hook, if the worker was created with
errorReporting set to true, any exception escaping from operation will
be handled by processUnhandledException.
afterMicroseconds: Long = 0,
operation: () -> Unit)
Park execution of the current worker until a new request arrives or timeout specified in timeoutMicroseconds elapsed. If process is true, pending queue elements are processed, including delayed requests. Note that multiple requests could be processed this way.
process: Boolean = false
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. If termination request arrives while processing the queue via this API, worker is marked as terminated and will exit once the current request is done with.
fun processQueue(): Boolean
Requests termination of the worker.
processScheduledJobs: Boolean = true
String representation of the worker.
fun toString(): String
Companion Object Properties
Companion Object Functions
Start new scheduling primitive, such as thread, to accept new tasks via
Typically new worker may be needed for computations offload to another core, for IO it may be
better to use non-blocking IO combined with more lightweight coroutines.
errorReporting: Boolean = true,
name: String? = null