예제 #1
0
파일: RubyThread.java 프로젝트: nahi/jruby
  public boolean waitForIO(ThreadContext context, RubyIO io, int ops) {
    Channel channel = io.getChannel();

    if (!(channel instanceof SelectableChannel)) {
      return true;
    }
    try {
      io.addBlockingThread(this);
      blockingIO = BlockingIO.newCondition(channel, ops);
      boolean ready = blockingIO.await();

      // check for thread events, in case we've been woken up to die
      pollThreadEvents();
      return ready;
    } catch (IOException ioe) {
      throw context.runtime.newRuntimeError("Error with selector: " + ioe);
    } catch (InterruptedException ex) {
      // FIXME: not correct exception
      throw context.runtime.newRuntimeError("Interrupted");
    } finally {
      blockingIO = null;
      io.removeBlockingThread(this);
    }
  }
예제 #2
0
파일: RubyThread.java 프로젝트: nahi/jruby
 public boolean select(RubyIO io, int ops, long timeout) {
   return select(io.getChannel(), io, ops, timeout);
 }
예제 #3
0
파일: RubyThread.java 프로젝트: nahi/jruby
 public boolean select(RubyIO io, int ops) {
   return select(io.getChannel(), io, ops);
 }