Colin
11/07/2018, 10:37 AMReceiveChannel
, and inside that function I am starting new suspended functions.
Pseudocode:
suspend fun produceStrings(): ReceiveChannel<String> {
return produce {
send(suspendedFunction1())
send(suspendedFunction2())
send(suspendedFunction3())
}
}
The code that calls produceStrings
is consuming the channel via consumeEach
. If at some point I cancel
the channel, I am expecting that the suspended functions inside the produce
block are stopped. i.e. I have a breakpoint in suspendedFunction3()
and I can see that the breakpoint is hit after I have cancelled the channel. Is this expected behaviour?marstran
11/07/2018, 10:55 AMdelay
function is the suspending version of Thread.sleep
.