title: How do I write native code which responds to `Thread.interrupt()`?
body: <p>In Java, all the standard blocking methods can be interrupted by calling <code>Thread.interrupt()</code>, but what if we have Java bindings wrapping a native library which does its own I/O? How then should the native code hook into the Thread and respond to calls to <code>Thread.interrupt()</code>?</p>