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

Comparing jsr166/src/test/tck/ReentrantLockTest.java (file contents):
Revision 1.64 by jsr166, Sun Jan 1 20:34:39 2017 UTC vs.
Revision 1.65 by jsr166, Sun May 14 02:03:15 2017 UTC

# Line 885 | Line 885 | public class ReentrantLockTest extends J
885      public void testAwaitUninterruptibly_fair() { testAwaitUninterruptibly(true); }
886      public void testAwaitUninterruptibly(boolean fair) {
887          final ReentrantLock lock = new ReentrantLock(fair);
888 <        final Condition c = lock.newCondition();
888 >        final Condition condition = lock.newCondition();
889          final CountDownLatch pleaseInterrupt = new CountDownLatch(2);
890  
891          Thread t1 = newStartedThread(new CheckedRunnable() {
# Line 894 | Line 894 | public class ReentrantLockTest extends J
894                  lock.lock();
895                  pleaseInterrupt.countDown();
896                  Thread.currentThread().interrupt();
897 <                c.awaitUninterruptibly();
897 >                condition.awaitUninterruptibly();
898                  assertTrue(Thread.interrupted());
899                  lock.unlock();
900              }});
# Line 904 | Line 904 | public class ReentrantLockTest extends J
904                  // Interrupt during awaitUninterruptibly
905                  lock.lock();
906                  pleaseInterrupt.countDown();
907 <                c.awaitUninterruptibly();
907 >                condition.awaitUninterruptibly();
908                  assertTrue(Thread.interrupted());
909                  lock.unlock();
910              }});
911  
912          await(pleaseInterrupt);
913 +        t2.interrupt();
914          lock.lock();
915          lock.unlock();
916 <        t2.interrupt();
917 <
917 <        assertThreadStaysAlive(t1);
918 <        assertTrue(t2.isAlive());
916 >        assertThreadBlocks(t1, Thread.State.WAITING);
917 >        assertThreadBlocks(t2, Thread.State.WAITING);
918  
919          lock.lock();
920 <        c.signalAll();
920 >        condition.signalAll();
921          lock.unlock();
922  
923          awaitTermination(t1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines