Coroutines and deadlocks

The Java ForkJoinPool Executor.

Where did you find that?

Yes, but you have to avoid any blocking function, like runBlocking.

None of both is reasonable.
If you block a shared, limited pool supposing it contains always enough Thread to execute your code then you are wrong.

But your platform is JVM, not BEAM.

You are right, so you should care to not block none of Dispatcher.Default’s Thread, never, and consider Dispatcher.IO for blocking invocation.

runBlocking is a bridge function, you should use it if and only if you must block the thread.
My suggestion for you: use Dispatcher.Default thinking that it contains only one (or two) thread for the whole application.

1 Like