735 |
|
*/ |
736 |
|
public void testValidateOptimisticWriteLocked2() |
737 |
|
throws InterruptedException { |
738 |
< |
final CountDownLatch running = new CountDownLatch(1); |
738 |
> |
final CountDownLatch locked = new CountDownLatch(1); |
739 |
|
final StampedLock lock = new StampedLock(); |
740 |
|
final long p = assertValid(lock, lock.tryOptimisticRead()); |
741 |
|
|
742 |
|
Thread t = newStartedThread(new CheckedInterruptedRunnable() { |
743 |
|
public void realRun() throws InterruptedException { |
744 |
|
lock.writeLockInterruptibly(); |
745 |
< |
running.countDown(); |
745 |
> |
locked.countDown(); |
746 |
|
lock.writeLockInterruptibly(); |
747 |
|
}}); |
748 |
|
|
749 |
< |
running.await(); |
749 |
> |
locked.await(); |
750 |
|
assertFalse(lock.validate(p)); |
751 |
|
assertEquals(0L, lock.tryOptimisticRead()); |
752 |
|
t.interrupt(); |