does wrapping blocking calls `withContext(<http://...
# coroutines
a
does wrapping blocking calls
withContext(<http://Dispatchers.IO|Dispatchers.IO>)
stop my threads from getting 'blocked'?
s
No. It does not prevent threads from getting blocked. It does prevent the calling thread from being blocked (instead, the calling thread will be suspended) The Dispatchers.IO dispatcher, however, is designed to handle blocking threads (its pool is large and tailored for running code that may get blocked (often) - and do nothing but wait)
a
I thought it had only 64 threads
l
ONLY? 64 threads is a lot! You can still change it though.
That's the upper bound BTW, it won't create 64 threads if you only need 13.
a
Maybe client side 64 is a lot
I m looking at it from server side
l
On server side, you should use non blocking I/O whenever possible so you don't need
<http://Dispatchers.IO|Dispatchers.IO>
unless really needed for filesystem I/O.