05/18/2023, 11:49 AM
On JVM there is a ThreadContextElement. What is the equivalent for Kotlin Native? Use-case: I want to create a fixed thread pool (newFixedThreadPoolContext), but each thread (Worker) needs to have a unique resource (a database connection). Or is this impossible because there is no Kotlin native coroutine support/implementation? For example: contains the JVM thread updating/restoring, while on native this method ignore the coroutine context:

Patrick Steiger

05/18/2023, 11:56 AM
Not sure but I don’t believe it’s available


05/18/2023, 12:06 PM
Thanks for the link, I am just curious if this would be the right approach at all. I took a look at Exposed and it uses ThreadContextElement, because it is jvm only. I like the implementation to pass the db conn, which need to be connected to the thread/worker, using coroutine context elements.