coroutineworker / com.autodesk.coroutineworker

Package com.autodesk.coroutineworker

Types

CoroutineWorker
(JVM)

expect class CoroutineWorker

Encapsulates performing background work. On JVM, this use coroutines outright. In native, this uses Worker threads and manages its mutability/concurrency issues.

Functions

threadSafeSuspendCallback

expect suspend fun <T> threadSafeSuspendCallback(startAsync: (CompletionLambda<T>) -> CancellationLambda): T

Bridges a platform's callback-based async method to coroutines, ensuring that the coroutine is resumed on a thread appropriate for the platform

actual suspend fun <T> threadSafeSuspendCallback(startAsync: (<ERROR CLASS><T>) -> <ERROR CLASS>): T

threadSafeSuspendCallbackWithValue

suspend fun <T> threadSafeSuspendCallbackWithValue(startAsync: ((T) -> Unit) -> CancellationLambda): T

A convenience wrapper for threadSafeSuspendCallback, for when you don't intend to resume the continuation with an exception