```interface Scheduler { fun isMainThread(): Boo...
# coroutines
e
Copy code
interface Scheduler {
  fun isMainThread(): Boolean
  fun runTask(task: () -> (Unit))
  fun runTaskIn(duration: Duration, task: () -> (Unit))
}
Given a really simple scheduler like this that runs on a single main thread. Could someone show me how to create a Dispatcher with Delay and a function:
Copy code
fun <Return> blocking(block: suspend () -> (Return)): Return
That can be used to block any thread (including the main one) until a coroutine completes. Similar to runBlocking (if the runBlocking internals can somehow be used that would be great but I couldn't see a way)
e
none of the functions in that interface allow for waiting for a result
u
How about wrapping above
runTask*
with
suspendCoroutine
and then call it within
runBlocking
?