I’m sure this should be obvious, but given an exis...
# coroutines
s
I’m sure this should be obvious, but given an existing synchronous API that expects a blocking
InputStream
or
Reader
, what’s the correct way to wrap that such that I can call it as a suspendable function and map some sort of asynchronous communication such as a
Channel
into the given
InputStream
?
Should I wrap the blocking io in
with(<http://Dispatchers.IO|Dispatchers.IO>) { … }
then how to I map the asynchronous channel into a synchronous data structure?
k
For the time being, you should offload blocking IO to Dispatchers IO like above
however, you should watch this repo closely.
At some point in the future, it will support non blocking IO
s
Cool, thanks!