isClosedForReceive

The first one would be to check the property isClosedForReceive, which indicates whether or not the channel has been closed for receiving, as the following for example:

val channel = Channel<Int>()
channel.isClosedForReceive // false
channel.close()
channel.isClosedForReceive // true

If receive is called in a channel that is closed, a ClosedReceiveChannelException will be thrown:

val channel = Channel<Int>()
channel.close()
channel.receive()

This code will simply crash:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.182.66