Example #1
0
  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();
    }
  }
Example #2
0
 public void executeBlockingTask(BlockingTask task) throws InterruptedException {
   enterSleep();
   try {
     currentBlockingTask = task;
     pollThreadEvents();
     task.run();
   } finally {
     exitSleep();
     currentBlockingTask = null;
     pollThreadEvents();
   }
 }