Condition add(Channel channel, int ops, Object monitor) { IOChannel io = new IOChannel((SelectableChannel) channel, ops, monitor); registrationQueue.add(io); selector.wakeup(); return new Condition(io); } public void await(Channel channel, int op) throws InterruptedException {
public void await(Channel channel, int op) throws InterruptedException { add(channel, op, new Object()).await(); } }
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(); } } private volatile BlockingIO.Condition blockingIO = null;
@SuppressWarnings("deprecated") public synchronized void interrupt() { setInterrupt(); Selector activeSelector = currentSelector; if (activeSelector != null) { activeSelector.wakeup(); } BlockingIO.Condition iowait = blockingIO; if (iowait != null) { iowait.cancel(); } Unblocker task = this.unblockFunc; if (task != null) { task.wakeup(this, unblockArg); } // deprecated { BlockingTask t = currentBlockingTask; if (t != null) { t.wakeup(); } } // If this thread is sleeping or stopped, wake it notify(); }
@SuppressWarnings("deprecated") public synchronized void interrupt() { setInterrupt(); Selector activeSelector = currentSelector; if (activeSelector != null) { activeSelector.wakeup(); } BlockingIO.Condition iowait = blockingIO; if (iowait != null) { iowait.cancel(); } Unblocker task = this.unblockFunc; if (task != null) { task.wakeup(this, unblockArg); } // deprecated { BlockingTask t = currentBlockingTask; if (t != null) { t.wakeup(); } } // If this thread is sleeping or stopped, wake it notify(); }
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); } } public void beforeBlockingCall() {
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); } } public void beforeBlockingCall() {
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); } } public void beforeBlockingCall() {
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); } } public void beforeBlockingCall() {
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(); } } private volatile BlockingIO.Condition blockingIO = null;
public void await(Channel channel, int op) throws InterruptedException { add(channel, op, new Object()).await(); } }
public void await(Channel channel, int op) throws InterruptedException { add(channel, op, new Object()).await(); } }
public void await(Channel channel, int op) throws InterruptedException { add(channel, op, new Object()).await(); } }
Condition add(Channel channel, int ops, Object monitor) { IOChannel io = new IOChannel((SelectableChannel) channel, ops, monitor); registrationQueue.add(io); selector.wakeup(); return new Condition(io); } public void await(Channel channel, int op) throws InterruptedException {
Condition add(Channel channel, int ops, Object monitor) { IOChannel io = new IOChannel((SelectableChannel) channel, ops, monitor); registrationQueue.add(io); selector.wakeup(); return new Condition(io); } public void await(Channel channel, int op) throws InterruptedException {
Condition add(Channel channel, int ops, Object monitor) { IOChannel io = new IOChannel((SelectableChannel) channel, ops, monitor); registrationQueue.add(io); selector.wakeup(); return new Condition(io); } public void await(Channel channel, int op) throws InterruptedException {