public synchronized boolean recheck(WaitQueue.WaitNode w) { Node node = (Node)w; boolean pass = (permits_ >= node.requests); if (pass) permits_ -= node.requests; else wq_.insert(w); return pass; }
public synchronized boolean recheck(WaitQueue.WaitNode w) { Node node = (Node)w; boolean pass = (permits_ >= node.requests); if (pass) permits_ -= node.requests; else wq_.insert(w); return pass; }
public synchronized boolean recheck(WaitQueue.WaitNode w) { Node node = (Node)w; boolean pass = (permits_ >= node.requests); if (pass) permits_ -= node.requests; else wq_.insert(w); return pass; }
public synchronized boolean recheck(WaitQueue.WaitNode node) { Thread caller = Thread.currentThread(); if (owner_ == null) { owner_ = caller; holds_ = 1; return true; } else if (caller == owner_) { incHolds(); return true; } wq_.insert(node); return false; }
public synchronized boolean recheck(WaitQueue.WaitNode node) { Thread caller = Thread.currentThread(); if (owner_ == null) { owner_ = caller; holds_ = 1; return true; } else if (caller == owner_) { incHolds(); return true; } wq_.insert(node); return false; }
public synchronized boolean recheck(WaitQueue.WaitNode node) { Thread caller = Thread.currentThread(); if (owner_ == null) { owner_ = caller; holds_ = 1; return true; } else if (caller == owner_) { incHolds(); return true; } wq_.insert(node); return false; }
public void await() throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } if (Thread.interrupted()) throw new InterruptedException(); WaitQueue.WaitNode n = new WaitQueue.WaitNode(); wq.insert(n); for (int i=holdCount; i>0; i--) lock.unlock(); try { n.doWait(sync); } finally { for (int i=holdCount; i>0; i--) lock.lock(); } }
public void await() throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } if (Thread.interrupted()) throw new InterruptedException(); WaitQueue.WaitNode n = new WaitQueue.WaitNode(); wq.insert(n); for (int i=holdCount; i>0; i--) lock.unlock(); try { n.doWait(sync); } finally { for (int i=holdCount; i>0; i--) lock.lock(); } }
public void await() throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } if (Thread.interrupted()) throw new InterruptedException(); WaitQueue.WaitNode n = new WaitQueue.WaitNode(); wq.insert(n); for (int i=holdCount; i>0; i--) lock.unlock(); try { n.doWait(sync); } finally { for (int i=holdCount; i>0; i--) lock.lock(); } }
public boolean await(long timeout, TimeUnit unit) throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } if (Thread.interrupted()) throw new InterruptedException(); long nanos = unit.toNanos(timeout); WaitQueue.WaitNode n = new WaitQueue.WaitNode(); wq.insert(n); boolean success = false; for (int i=holdCount; i>0; i--) lock.unlock(); try { success = n.doTimedWait(sync, nanos); } finally { for (int i=holdCount; i>0; i--) lock.lock(); } return success; }
public boolean await(long timeout, TimeUnit unit) throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } if (Thread.interrupted()) throw new InterruptedException(); long nanos = unit.toNanos(timeout); WaitQueue.WaitNode n = new WaitQueue.WaitNode(); wq.insert(n); boolean success = false; for (int i=holdCount; i>0; i--) lock.unlock(); try { success = n.doTimedWait(sync, nanos); } finally { for (int i=holdCount; i>0; i--) lock.lock(); } return success; }
public boolean await(long timeout, TimeUnit unit) throws InterruptedException { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } if (Thread.interrupted()) throw new InterruptedException(); long nanos = unit.toNanos(timeout); WaitQueue.WaitNode n = new WaitQueue.WaitNode(); wq.insert(n); boolean success = false; for (int i=holdCount; i>0; i--) lock.unlock(); try { success = n.doTimedWait(sync, nanos); } finally { for (int i=holdCount; i>0; i--) lock.lock(); } return success; }
public void awaitUninterruptibly() { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } WaitQueue.WaitNode n = new WaitQueue.WaitNode(); wq.insert(n); for (int i=holdCount; i>0; i--) lock.unlock(); try { n.doWaitUninterruptibly(sync); } finally { for (int i=holdCount; i>0; i--) lock.lock(); } }
public void awaitUninterruptibly() { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } WaitQueue.WaitNode n = new WaitQueue.WaitNode(); wq.insert(n); for (int i=holdCount; i>0; i--) lock.unlock(); try { n.doWaitUninterruptibly(sync); } finally { for (int i=holdCount; i>0; i--) lock.lock(); } }
public void awaitUninterruptibly() { int holdCount = lock.getHoldCount(); if (holdCount == 0) { throw new IllegalMonitorStateException(); } WaitQueue.WaitNode n = new WaitQueue.WaitNode(); wq.insert(n); for (int i=holdCount; i>0; i--) lock.unlock(); try { n.doWaitUninterruptibly(sync); } finally { for (int i=holdCount; i>0; i--) lock.lock(); } }