napperley
07/01/2021, 2:32 AMkotlin.IllegalStateException: There is no event loop. Use runBlocking { ... } to start one.
at kfun:kotlinx.coroutines.takeEventLoop#internal (0x312759)
at kfun:kotlinx.coroutines.DefaultExecutor#dispatch(kotlin.coroutines.CoroutineContext;kotlinx.coroutines.Runnable){} (0x312570)
at kfun:kotlinx.coroutines.internal#resumeCancellableWith@kotlin.coroutines.Continuation<0:0>(kotlin.Result<0:0>;kotlin.Function1<kotlin.Throwable,kotlin.Unit>?){0§<kotlin.Any?>} (0x30d572)
at kfun:kotlinx.coroutines.intrinsics#startCoroutineCancellable$default@kotlin.coroutines.SuspendFunction1<0:0,0:1>(0:0;kotlin.coroutines.Continuation<0:1>;kotlin.Function1<kotlin.Throwable,kotlin.Unit>?;kotlin.Int){0§<kotlin.Any?>;1§<kotlin.Any?>} (0x3118a4)
at kfun:kotlinx.coroutines.AbstractCoroutine#start(kotlinx.coroutines.CoroutineStart;0:0;kotlin.coroutines.SuspendFunction1<0:0,1:0>){0§<kotlin.Any?>} (0x2f8f69)
at kfun:kotlinx.coroutines#launch$default@kotlinx.coroutines.CoroutineScope(kotlin.coroutines.CoroutineContext?;kotlinx.coroutines.CoroutineStart?;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,kotlin.Unit>;kotlin.Int){}kotlinx.coroutines.Job (0x2f9d37)
at _636f6d2e636861706d616e3a626f6c742d646174612d636f6e73756d6572_kncfun86 (0x333419)
at MQTTClient_run (0x34a3c3)
at (0x7f7e4de366db)
at clone (0x7f7e4d947a3f)
at ((nil))
I want to run IO bound tasks (network orientated) that run on a separate thread. The main thread with the linuxX64 target is mainly used for tasks that need to block (eg printing messages to the console). Linux unlike JS (the JavaScript platform) for example allows for multiple threads to run at once.Dominaezzz
07/01/2021, 7:40 AMDominaezzz
07/01/2021, 7:40 AMnapperley
07/01/2021, 11:33 PMnapperley
07/01/2021, 11:34 PM