aaverin
08/29/2018, 7:33 PMblockingProduce
? I have an async callback that I want to wrap into a channeldeviant
08/29/2018, 7:50 PMproduce
aaverin
08/29/2018, 7:53 PMDominaezzz
08/29/2018, 8:12 PMdeviant
08/29/2018, 8:25 PMit closes before my callback sends any datajust make a loop with suspension point inside
aaverin
08/29/2018, 8:30 PMDominaezzz
08/29/2018, 8:31 PMaaverin
08/29/2018, 8:31 PMDominaezzz
08/29/2018, 8:32 PMaaverin
08/29/2018, 8:34 PMsuspendCoroutine
that would publish into a channel?Dominaezzz
08/29/2018, 8:35 PMsuspendCoroutine
, you can only call the Continuation
once, as supposed to multiple times, which is what you need.fun magicAsync(): ReceiveChannel<Item> {
val ch = Channel(...)
magic(..., { it -> ch.send(it) })
return ch
}
aaverin
08/29/2018, 8:39 PM