Is it possible to get the parallelism of a `Corout...
# coroutines
j
Is it possible to get the parallelism of a
CoroutineDispatcher
? I'm trying to create a mapping to dispatch_queue_t on iOS, similar to asExecutor on the JVM. Since
dispatch_queue_t
is an opaque type, it's not possible to implement something like DispatcherExecutor. While it would be possible to wrap a
dispatch_queue_t
as a
CoroutineDispatcher
, I need to support the reverse, where a user provides a
CoroutineDispatcher
in common Kotlin code and I use that dispatcher as a
dispatch_queue_t
calling a native API in iOS platform code.
The best I've been able to figure is always use
dispatch_queue_create
to create a
dispatch_queue_serial_t
, assuming the dispatcher has a parallelism of 1, since I can't differentiate between serial and concurrent dispatchers definitively.
Dispatchers.Main
should use
dispatch_get_main_queue
of course.