public synchronized void doWaitUninterruptibly(QueuedSync sync) { if (!sync.recheck(this)) { boolean wasInterrupted = Thread.interrupted(); try { while (waiting) { try { wait(); } catch (InterruptedException ex) { wasInterrupted = true; // no need to notify; if we were signalled, we // must be not waiting, and we'll act like signalled } } } finally { if (wasInterrupted) Thread.currentThread().interrupt(); } } } }
public synchronized boolean signal(QueuedSync sync) { boolean signalled = waiting; if (signalled) { waiting = false; notify(); sync.takeOver(this); } return signalled; }
public synchronized boolean doTimedWait(QueuedSync sync, long nanos) throws InterruptedException if (sync.recheck(this) || !waiting) return true; else if (nanos <= 0) {
public synchronized boolean doTimedWait(QueuedSync sync, long nanos) throws InterruptedException if (sync.recheck(this) || !waiting) return true; else if (nanos <= 0) {
public synchronized boolean doTimedWait(QueuedSync sync, long nanos) throws InterruptedException if (sync.recheck(this) || !waiting) return true; else if (nanos <= 0) {
public synchronized void doWaitUninterruptibly(QueuedSync sync) { if (!sync.recheck(this)) { boolean wasInterrupted = Thread.interrupted(); try { while (waiting) { try { wait(); } catch (InterruptedException ex) { wasInterrupted = true; // no need to notify; if we were signalled, we // must be not waiting, and we'll act like signalled } } } finally { if (wasInterrupted) Thread.currentThread().interrupt(); } } } }
public synchronized void doWait(QueuedSync sync) throws InterruptedException { if (!sync.recheck(this)) { try { while (waiting) wait(); } catch (InterruptedException ex) { if (waiting) { // no notification waiting = false; // invalidate for the signaller throw ex; } else { // thread was interrupted after it was notified Thread.currentThread().interrupt(); return; } } } }
public synchronized void doWaitUninterruptibly(QueuedSync sync) { if (!sync.recheck(this)) { boolean wasInterrupted = Thread.interrupted(); try { while (waiting) { try { wait(); } catch (InterruptedException ex) { wasInterrupted = true; // no need to notify; if we were signalled, we // must be not waiting, and we'll act like signalled } } } finally { if (wasInterrupted) Thread.currentThread().interrupt(); } } } }
public synchronized void doWait(QueuedSync sync) throws InterruptedException { if (!sync.recheck(this)) { try { while (waiting) wait(); } catch (InterruptedException ex) { if (waiting) { // no notification waiting = false; // invalidate for the signaller throw ex; } else { // thread was interrupted after it was notified Thread.currentThread().interrupt(); return; } } } }
public synchronized void doWait(QueuedSync sync) throws InterruptedException { if (!sync.recheck(this)) { try { while (waiting) wait(); } catch (InterruptedException ex) { if (waiting) { // no notification waiting = false; // invalidate for the signaller throw ex; } else { // thread was interrupted after it was notified Thread.currentThread().interrupt(); return; } } } }
public synchronized boolean signal(QueuedSync sync) { boolean signalled = waiting; if (signalled) { waiting = false; notify(); sync.takeOver(this); } return signalled; }
public synchronized boolean signal(QueuedSync sync) { boolean signalled = waiting; if (signalled) { waiting = false; notify(); sync.takeOver(this); } return signalled; }