public void lockInterruptibly() throws InterruptedException { if (Thread.interrupted()) throw new InterruptedException(); Thread caller = Thread.currentThread(); synchronized (this) { if (owner_ == null) { owner_ = caller; holds_ = 1; return; } else if (caller == owner_) { incHolds(); return; } } WaitQueue.WaitNode n = new WaitQueue.WaitNode(); n.doWait(this); }
public void acquire(int n) throws InterruptedException { if (Thread.interrupted()) throw new InterruptedException(); if (precheck(n)) return; WaitQueue.WaitNode w = new Node(n); w.doWait(this); }
public void acquire(int n) throws InterruptedException { if (Thread.interrupted()) throw new InterruptedException(); if (precheck(n)) return; WaitQueue.WaitNode w = new Node(n); w.doWait(this); }
public void lockInterruptibly() throws InterruptedException { if (Thread.interrupted()) throw new InterruptedException(); Thread caller = Thread.currentThread(); synchronized (this) { if (owner_ == null) { owner_ = caller; holds_ = 1; return; } else if (caller == owner_) { incHolds(); return; } } WaitQueue.WaitNode n = new WaitQueue.WaitNode(); n.doWait(this); }
public void lockInterruptibly() throws InterruptedException { if (Thread.interrupted()) throw new InterruptedException(); Thread caller = Thread.currentThread(); synchronized (this) { if (owner_ == null) { owner_ = caller; holds_ = 1; return; } else if (caller == owner_) { incHolds(); return; } } WaitQueue.WaitNode n = new WaitQueue.WaitNode(); n.doWait(this); }
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 void acquire(int n) throws InterruptedException { if (Thread.interrupted()) throw new InterruptedException(); if (precheck(n)) return; WaitQueue.WaitNode w = new Node(n); w.doWait(this); }