What is alternative for thread pool in kotlin-nati...
# kotlin-native
k
What is alternative for thread pool in kotlin-native ? And why coroutines not handling C blocking functions ? For example read() or write() are blocking I wanna use it in coroutines.
a
I would guess that there's nothing on the standard C libraries (perhaps except by some private compiler extension) that would tell that some function is a blocking one. Thus I think it is up to you to write the continuation wrapper. I also think you would be better using a kotlin I/O ( perhaps https://ktor.io/kotlinx/io.html) than the C one
k
I want some background tasks which requires pthread_create which need function as input. Well here I stuck. If I use CPointer<CFunction> I have to do everything inside that function or I define outside like c does (class concept unusable). So I need something alternative to do background task or something to pass function with freedom of exchange data between CFunction