Does kotlin have an equivalent of twisted’s `defer...
# coroutines
p
Does kotlin have an equivalent of twisted’s
deferToThread()
? IE, a neat, packaged way to spawn a thread/run some blocking work on a thread pool, and monitor it from a coroutine which resumes the caller when the blocking code finishes?
Actually, think I answered my own question. Sorry, still an early learner!
But I think the answer is
Copy code
withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
    someBlockingOperation()
}
(right? 😄 )
r
Possibly
async
if you want to start a new coroutine, but it's Dispatchers.IO, yeah.
p
thanks!