My use case is that I have a blocking call on native which waits for the kernel to do something. It is
not a syscall. Because
runInterruptable
does not support native, I'm having to use a blocking call that times, and then spin needlessly with an arbitrary timeout.
For reference, this is all in the context of binding kotlin native to
io_uring
. I would like to be able to do the following:
val dispatcher = newSingleThreadedContext(...)
runInterruptable(context = dispatcher) {
while (true) {
io_uring_wait_cqe(...) // blocks until kernel gives us a value.
}
}
Instead I am having to do this:
val dispatcher = newSingleThreadedContext(...)
val timeout = /* 100 milliseconds */
withContext(dispatcher) {
while (isActive) {
io_uring_wait_cqe_timeout(..., timeout) // blocks for 100ms or until kernel gives us a value.
}
}