Hi, I'm trying to understand how to use coroutines in my use case... I am using the JVM (and not android). My code doesn't current use coroutines, I'm using Java CompleteableFuture to do async work.
The type of work I'm doing is Fire and Forget type of stuff (I have an infinite while loop doing video/image processing.
I currently have no
suspend
functions, but I could get my code to work with the
GlobalScope.launch
function. Now I've read in several places that I should avoid using the GlobalScope. So my question is, how can I create a coroutine scope for a given method (not the main) and still use coroutines for a fire and forget type of work.
I've tried doing something like
fun myMethod() = runBlocking { .... }
and then inside use
CoroutineScope.launch
but the code after the
launch
block is still blocked by the
launch
block. What could I do to make this work?