public void interrupt() { Selector activeSelector = currentSelector; if (activeSelector != null) { activeSelector.wakeup(); } BlockingIO.Condition iowait = blockingIO; if (iowait != null) { iowait.cancel(); } BlockingTask task = currentBlockingTask; if (task != null) { task.wakeup(); } }
public void executeBlockingTask(BlockingTask task) throws InterruptedException { enterSleep(); try { currentBlockingTask = task; pollThreadEvents(); task.run(); } finally { exitSleep(); currentBlockingTask = null; pollThreadEvents(); } }