groostav
10/29/2024, 10:49 PMSam
10/30/2024, 7:28 AMstartLargeWork()
from inside a coroutine. Give it its own thread if necessary.Sam
10/30/2024, 7:29 AMSam
10/30/2024, 7:30 AMrunBlocking { trySend() }
, so same rules apply—never call it from a thread that belongs to a coroutine or coroutine dispatcher.Sam
10/30/2024, 7:33 AMSam
10/30/2024, 7:35 AMflow {…}
builder to wrap a call to collect {…}
.
fun <T> Flow<T>.myOperator() = flow {
collect { upstream ->
emit(doStuffWith(upstream))
}
}
I'm not sure if this solves the problem you were facing with your paused
messages, but as a general pattern it's extremely powerful.