You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just started a very simple hello world console application with Kotlin/Native for a linuxX64 target.
I want to increment a counter and print it every two seconds to the command line:
funmain() = runBlocking {
var i =0while(isActive){
println("Hello Kotlin/Native COROUTINE #${++i}")
delay(2000)
}
}
When I run the binary on a the target host I encounter that CPU usage increases by 25% (one core being totally occupied). So it seems this is blocking the thread totally.
When I replace the delay(...) suspend function with a platform.posix.sleep(2) there is no noticeable CPU usage increase (0%).
Hi all,
I just started a very simple hello world console application with Kotlin/Native for a linuxX64 target.
I want to increment a counter and print it every two seconds to the command line:
When I run the binary on a the target host I encounter that CPU usage increases by 25% (one core being totally occupied). So it seems this is blocking the thread totally.
When I replace the
delay(...)
suspend function with aplatform.posix.sleep(2)
there is no noticeable CPU usage increase (0%).here my build.gradle.kts:
Is this a known issue ? or is just me being new to Kotlin/Native and coroutines... (bear with me if that's the case)
Many thanks for your support and the great efforts you put into bringing Kotlin coroutines to every platform !
Best regards,
Thomas
The text was updated successfully, but these errors were encountered: