コード例 #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);
 }