paulex
03/25/2020, 8:16 AMoctylFractal
03/25/2020, 8:18 AMpaulex
03/25/2020, 8:30 AMtseisel
03/25/2020, 8:31 AMmain
function) on non-UI application due to the lack of an event loop, you could use newSingleThreadContext()
to create a dispatcher to use as your main thread.
Note that you'll have to block the first thread (with runBlocking
and withContext
, or using launch
and awaiting on the resulting job), otherwise the program will terminate.octylFractal
03/25/2020, 8:39 AMwhile
loop thoughpaulex
03/25/2020, 8:47 AMArbitraryMainDispatcher
etc... What am i not reading right?octylFractal
03/25/2020, 8:49 AMArbitraryMainDispatcher
based on the JavaFX
main dispatcher, and gave it queue(Runnable)
as a stand-in for JavaFX's Platform.runLater(Runnable)
. The main part is knowing that MainCoroutineDispatcher
existspaulex
03/25/2020, 8:51 AMtseisel
03/25/2020, 8:53 AMZach Klippenstein (he/him) [MOD]
03/25/2020, 3:14 PMDispatchers.Main
for javafx, is there some reason you can't use that? https://github.com/Kotlin/kotlinx.coroutines/blob/master/ui/kotlinx-coroutines-javafx/README.mdoctylFractal
03/25/2020, 8:21 PMZach Klippenstein (he/him) [MOD]
03/25/2020, 9:40 PM