@Joffrey This is true, a new one will be launched but I think there is misunderstanding here, If I understand his question correctly, he is asking if
collect {}
is being executed on another thread (or a pool of threads) concurrently and the the caller thread would continue to execute the next code block, but
collect {}
will just suspend the current thread until the work is done that is why I suggested
launchIn
that takes a scope parameter in which he can configure the scope to collect the flow in a different pool of threads and even control the number of threads in that pool. I hope you get my POV and feel free to correct me if I'm wrong.
j
Joffrey
05/01/2022, 11:43 PM
@MR3Y yep what you said is correct. I just think the OP was asking about processing the elements of the flow concurrently, not about processing the flow concurrently with some other work (the new code from the op seems to confirm that)