Interrupt JNI method execution in a coroutine
I have a JNI method that I want to execute concurrently being able to cancel the coroutine while this method is being executed.
external fun myNativeFunction()
I tried using runInterruptible but this does not help.
runInterruptible {
myNativeFunction()
// The coroutine is cancelled only when it reaches here
}
Is there a way to cancel the execution of a JNI method without waiting for it to finish?