Detecting thread interruption with JNA native wait call (Windows)
I'm trying to write some code that performs a wait via JNA (e.g. by calling the Kernel32 function WaitForSingleObject), but I'd also like the wait to finish if Thread.interrupt() is called; I assume Java uses something like an Event object to implement interruption; is there any way of getting the Event from Java in order to use it in a call to WaitForMultipleObjects? Or is there any other way I could arrange for my wait to finish if the thread is interrupted? Java supports it via NIO and very few people are aware of, the class in question is abstract but that's no issue: java.nio.channels.spi