Michael Ralston
09/17/2021, 10:38 AMBaidyanath
09/17/2021, 10:43 AMMichael Ralston
09/17/2021, 10:47 AMrunBlocking
statement?evestera
09/17/2021, 12:36 PMlaunch(newSingleThreadContext("MyOwnThread")) { // will get its own new thread
println("newSingleThreadContext: I'm working in thread ${Thread.currentThread().name}")
}
https://kotlinlang.org/docs/coroutine-context-and-dispatchers.html#dispatchers-and-threads
Though you could very well just use an ExecutorService
if you don't really need any of the coroutine features.enleur
09/17/2021, 1:44 PMJoffrey
09/17/2021, 3:25 PMCoroutineScope
in that component and cancel()
it when that lifecycle ends (to avoid leaking coroutines). Use this scope to launch the coroutines that must outlive the function that starts themLuiz Aguiar
09/18/2021, 10:01 PMMichael Ralston
09/19/2021, 9:06 PMJoffrey
09/19/2021, 9:30 PMJames Richardson
09/23/2021, 7:04 AM