Hi! Sometimes it takes very very long to get into ...
# coroutines
w
Hi! Sometimes it takes very very long to get into a coroutine. For example:
Copy code
<http://logger.info|logger.info>("command = start")
                    launch(CommonPool) {
                        <http://logger.info|logger.info>("in pool for start")
I get the
in pool for start
message minutes later than
command = start
message. Am I not using coroutines correctly? I am running a lot of stuff in these launch(CommonPool) blocks.
d
The common pool is designed for tasks that "wait a lot", it is limited in threads to I think two times the core count. So if you have that many coroutines "actually doing things" in there, new coroutines will wait around until a thread is free.
w
ah, thank you! I'll keep that in mind because I was indeed using around ~20 coroutines I think...
d
Just checked, it's not even two times the core count, it's core count - 1.
Oh, and just to clarify, you can use coroutines just fine for this, but you should probably make your own thread pool.