Closes this channel.
This is an idempotent operation – subsequent invocations of this function have no effect and return
Conceptually, its sends a special “close token” over this channel.
Immediately after invocation of this function
isClosedForSend starts returning
true. However, isClosedForReceive
on the side of ReceiveChannel starts returning
true only after all previously sent elements
A channel that was closed without a cause throws ClosedSendChannelException on attempts to send and ClosedReceiveChannelException on attempts to receive. A channel that was closed with non-null cause is called a failed channel. Attempts to send or receive on a failed channel throw the specified cause exception.