julioyg
01/30/2019, 4:27 PMjulioyg
01/30/2019, 4:37 PMgildor
01/30/2019, 4:40 PMjulioyg
01/30/2019, 4:40 PMisClosedForReceive
it's false
...julioyg
01/30/2019, 4:41 PMfun main() {
var channel: ReceiveChannel<String>? = null
var broadcastChannel = BroadcastChannel<String>(1)
val job = GlobalScope.launch {
channel = broadcastChannel.openSubscription()
}
job.cancel()
Thread.sleep(1000)
println("is closed ${channel!!.isClosedForReceive}")
}
julioyg
01/30/2019, 4:42 PMfalse
julioyg
01/30/2019, 4:42 PMjulioyg
01/30/2019, 4:43 PMAllan Wang
01/30/2019, 6:45 PMAllan Wang
01/30/2019, 6:45 PMjulioyg
01/30/2019, 7:21 PMconsumeEach
thanks bot for the helpjulioyg
01/30/2019, 7:22 PMBroadcastChannel
so when you call openSubscription
it creates a new channel, so (reading the github issue) even if you close the channel returned by openSubscription
you can still send items to the BroadcastChannel