If I wanted to create my own MainCoroutineDispatch...
# coroutines
d
If I wanted to create my own MainCoroutineDispatcher(), what's the fastest way to do so?
z
Why?
d
I’m playing around with lwjgl and it has a lot of methods that need to run from the main thread on OSX.
Seems like it would be the right bridge for coroutines and LWJGL
k
I don't know what lwjgl is, but have you considered looking at other implementations of main dispatchers? It will require hooking dispatch calls up to whatever the platforms equivalent would be. Eg. Post on Android loopers
d
I looked at the Swing implementation. It looks kind of simple. I’m just not sure how the loader finds the factory.
LWJGL is “Light Weight Java Gaming Library”. It’s a JVM interface into OpenGL/OpenCL/OpenAL.
👍 1
d
The fastest way would be to copy-paste code from something like https://github.com/Kotlin/kotlinx.coroutines/tree/master/ui/kotlinx-coroutines-swing, including the resource directory.
thank you color 1