inline class Worker
Class representing worker.
val id: Int
Convert worker to a COpaquePointer value that could be passed via native void* pointer. Can be used as an argument of Worker.fromCPointer.
fun asCPointer(): COpaquePointer?
Plan job for further execution in the worker. Execute is a two-phase operation:
fun <T1, T2> execute( mode: TransferMode, producer: () -> T1, job: (T1) -> T2 ): Future<T2>
Requests termination of the worker.
fun requestTermination( processScheduledJobs: Boolean = true ): Future<Unit>
Returns a string representation of the object.
fun toString(): String
Return the current worker, if known, null otherwise. null value will be returned in the main thread or platform thread without an associated worker, non-null - if called inside worker started with Worker.start.
val current: Worker?
Create worker object from a C pointer.
fun fromCPointer(pointer: COpaquePointer?): Worker
Start new scheduling primitive, such as thread, to accept new tasks via execute
interface. 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.
fun start(errorReporting: Boolean = true): Worker
© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.concurrent/-worker/index.html