https://kotlinlang.org logo
i

Iain Merrick

12/02/2021, 5:22 PM
Is there any option to generate purely single-threaded code? For my use cases, I feel like it might be easier to make stuff work in one thread than to debug multithreading issues.
s

simon.vergauwen

12/02/2021, 5:31 PM
Copy code
newSingleThreadContext("main").use { ctx ->
  val a = runBlocking<A>(ctx) {
    fa()
  }
}
👍 1
i

Iain Merrick

12/02/2021, 5:40 PM
Interesting, thanks!
j

jimn

12/02/2021, 6:13 PM
you may want to try out new-memory concurrency it supposedly removes freezing.
i

Iain Merrick

12/02/2021, 9:28 PM
@jimn I had a look at the docs, that might be a winner! Although it’s a bit scary that it’s changing so much
j

jimn

12/10/2021, 1:49 AM
so far so good here on linux native C p_thread code talking to the kernel. i backed off the available pthread testing samples when i ran into the freeze barriers but came back to it and currently have new-memory build that succeeds with original pthread code out of the box.
3 Views