expect class CoroutineWorker
Platform and version requirements: JVM
Encapsulates performing background work. On JVM, this use coroutines outright. In native, this uses Worker threads and manages its mutability/concurrency issues.
CoroutineWorker() |
val coroutineContext: <ERROR CLASS> |
fun cancel(): Unit
Cancels the underlying Job |
|
suspend fun cancelAndJoin(): Unit
Cancel the underlying job/worker and waits for it to receive its cancellation message or complete |
fun execute(block: suspend <ERROR CLASS>.() -> Unit): CoroutineWorker
Enqueues the background work to run and returns a reference to the worker, which can be cancelled |
|
suspend fun <T> performAndWait(block: suspend <ERROR CLASS>.() -> T): T
Enqueues the background work to run, suspends while the work is in progress, and returns the result of that background work back to the calling thread |