If I call `delay` or any other blocking operation ...
# coroutines
f
If I call
delay
or any other blocking operation inside the
collect
block of a Flow, the next value will not be collected until that delay is over right? So I can't get race conditions between successive emissions of the Flow?
d
Yes, `Flow`s are very strictly sequential.
f
thank you
p
Isn't it dependent on the dispatcher?
If you collect on the io dispatcher imo you can get concurrent emissions
d
Dispatcher only affects which thread it runs on. The collectors have checks to make sure emission stay sequential (and other nice safe things).
s
And that ^^^ is one of the main strengths of 'suspend' behavior. Regardless of the dispatcher's number of threads, it guarantees that code can be called sequentially. 😃