Are there any other pools that ship with coroutine...
# coroutines
o
Are there any other pools that ship with coroutines than the CommonPool? The common pool is backed by ForkJoinPool which unfortunately isn’t great for I/O intensive tasks where most the time is spent waiting.
g
You can also use the extension function
asCoroutineDIspatcher()
on an
ExecutorService
to convert any executor service into a context/dispatcher
d
Coroutines are meant for spuspended functions. If you make your idling calls
suspend
, threads won't be blocked AFAIK
o
Thanks @groostav
@dekans The main problem with the FJP is how it handles parallelism internally although I will try to make my idling calls suspend.
g
@omarkj @dekans I must confess I was very bullish about coroutines (and still am), but IO has been a wet-blanket on the whole thing. We're using (blocking)
FileChannel/io
in some places, old-school streams in others, and even Kernel32 pipes in some. these objects dont have nice suspendable/CompletableFuture/callback-based API's so I'm left to writing wrapper functions that dedicate a thread to a blocking call and offer the result on a
suspend fun
o
I have a decent callback-based API I’m working with, but the volume of callbacks is causing me some issues.
Currently working on ~30 callbacks resolving a few thousands futures (since it’s batch work). This is causing me some headaches.