ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/StampedLockTest.java
(Generate patch)

Comparing jsr166/src/test/tck/StampedLockTest.java (file contents):
Revision 1.30 by jsr166, Sat Feb 18 00:32:30 2017 UTC vs.
Revision 1.31 by jsr166, Sat Feb 18 00:34:52 2017 UTC

# Line 479 | Line 479 | public class StampedLockTest extends JSR
479       * A writelock succeeds only after a reading thread unlocks
480       */
481      public void testWriteAfterReadLock() throws InterruptedException {
482 <        final CountDownLatch running = new CountDownLatch(1);
482 >        final CountDownLatch threadStarted = new CountDownLatch(1);
483          final StampedLock lock = new StampedLock();
484          long rs = lock.readLock();
485          Thread t = newStartedThread(new CheckedRunnable() {
486              public void realRun() {
487 <                running.countDown();
487 >                threadStarted.countDown();
488                  long s = lock.writeLock();
489                  lock.unlockWrite(s);
490              }});
491  
492 <        running.await();
492 >        threadStarted.await();
493          waitForThreadToEnterWaitState(t, MEDIUM_DELAY_MS);
494          assertFalse(lock.isWriteLocked());
495          lock.unlockRead(rs);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines