682683684685686687688689690691692
Thread t2 = new Thread(new Runnable() { public void run() { try { cb.waitForTurn(3); synchronized (lock) { cb.signalTurn(4); lock.acquire(owner3, ReadWriteLock.WRITE_LOCK, true, GenericLock.COMPATIBILITY_REENTRANT, true, TIMEOUT); } lock.release(owner3); synchronized (restart) {
700701702703704705706707708709710
t2.start(); cb.waitForTurn(1); lock.acquireRead(owner1, TIMEOUT); cb.signalTurn(2); cb.waitForTurn(4); synchronized (lock) { lock.release(owner1); } synchronized (restart) {
739740741742743744745746747748749
Thread t1 = new Thread(new Runnable() { public void run() { try { cb.waitForTurn(2); manager.lock(owner2, res1, 1, true); cb.signalTurn(3); manager.releaseAll(owner2); synchronized (restart) { restart.meet(); restart.reset(); }
755756757758759760761762763764765
t1.start(); cb.waitForTurn(1); manager.startGlobalTimeout(owner1, 500); manager.lock(owner1, res1, 1, true); cb.signalTurn(2); cb.waitForTurn(3); boolean failed = false; try { manager.tryLock(owner1, res1, 1, true); } catch (LockException le) {
525526527528529530531532533534535
Thread t1 = new Thread(new Runnable() { public void run() { try { cb.waitForTurn(2); manager.upgradeLock(owner2, res1); cb.signalTurn(3); cb.waitForTurn(5); synchronized (manager.getLock(res1)) { cb.signalTurn(6); manager.writeLock(owner2, res1); }
528529530531532533534535536537538
cb.waitForTurn(2); manager.upgradeLock(owner2, res1); cb.signalTurn(3); cb.waitForTurn(5); synchronized (manager.getLock(res1)) { cb.signalTurn(6); manager.writeLock(owner2, res1); } // we must always be first as we will be preferred over // as I had the upgrade // lock before
561562563564565566567568569570571
// next to get the lock as it is preferred over the main // thread // that only waits for a read lock cb.waitForTurn(6); synchronized (manager.getLock(res1)) { cb.signalTurn(7); manager.readLock(owner3, res1); } synchronized (this) { if (first == null) first = owner3;
582583584585586587588589590591592
t2.start(); cb.waitForTurn(1); manager.readLock(owner1, res1); cb.signalTurn(2); cb.waitForTurn(3); manager.release(owner1, res1); manager.readLock(owner1, res1); cb.signalTurn(5); cb.waitForTurn(7);
586587588589590591592593594595596
manager.readLock(owner1, res1); cb.signalTurn(2); cb.waitForTurn(3); manager.release(owner1, res1); manager.readLock(owner1, res1); cb.signalTurn(5); cb.waitForTurn(7); synchronized (manager.getLock(res1)) { manager.releaseAll(owner1); } synchronized (restart) {
654655656657658659660661662663664
Thread t1 = new Thread(new Runnable() { public void run() { try { cb.waitForTurn(2); synchronized (lock) { cb.signalTurn(3); lock.acquire(owner2, ReadWriteLock.WRITE_LOCK, true, GenericLock.COMPATIBILITY_REENTRANT, true, TIMEOUT); } lock.release(owner2); synchronized (restart) {