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

Comparing jsr166/src/test/tck/AbstractQueuedSynchronizerTest.java (file contents):
Revision 1.53 by jsr166, Sun Jan 1 20:34:39 2017 UTC vs.
Revision 1.57 by jsr166, Mon Jul 17 21:01:30 2017 UTC

# Line 19 | Line 19 | import junit.framework.AssertionFailedEr
19   import junit.framework.Test;
20   import junit.framework.TestSuite;
21  
22 + @SuppressWarnings("WaitNotInLoop") // we implement spurious-wakeup freedom
23   public class AbstractQueuedSynchronizerTest extends JSR166TestCase {
24      public static void main(String[] args) {
25          main(suite(), args);
# Line 968 | Line 969 | public class AbstractQueuedSynchronizerT
969       */
970      public void testAwaitUninterruptibly() {
971          final Mutex sync = new Mutex();
972 <        final ConditionObject c = sync.newCondition();
972 >        final ConditionObject condition = sync.newCondition();
973          final BooleanLatch pleaseInterrupt = new BooleanLatch();
974          Thread t = newStartedThread(new CheckedRunnable() {
975              public void realRun() {
976                  sync.acquire();
977                  assertTrue(pleaseInterrupt.releaseShared(0));
978 <                c.awaitUninterruptibly();
978 >                condition.awaitUninterruptibly();
979                  assertTrue(Thread.interrupted());
980 <                assertHasWaitersLocked(sync, c, NO_THREADS);
980 >                assertHasWaitersLocked(sync, condition, NO_THREADS);
981                  sync.release();
982              }});
983  
984          pleaseInterrupt.acquireShared(0);
985          sync.acquire();
986 <        assertHasWaitersLocked(sync, c, t);
986 >        assertHasWaitersLocked(sync, condition, t);
987          sync.release();
988          t.interrupt();
989 <        assertHasWaitersUnlocked(sync, c, t);
990 <        assertThreadStaysAlive(t);
989 >        assertHasWaitersUnlocked(sync, condition, t);
990 >        assertThreadBlocks(t, Thread.State.WAITING);
991          sync.acquire();
992 <        assertHasWaitersLocked(sync, c, t);
992 >        assertHasWaitersLocked(sync, condition, t);
993          assertHasExclusiveQueuedThreads(sync, NO_THREADS);
994 <        c.signal();
995 <        assertHasWaitersLocked(sync, c, NO_THREADS);
994 >        condition.signal();
995 >        assertHasWaitersLocked(sync, condition, NO_THREADS);
996          assertHasExclusiveQueuedThreads(sync, t);
997          sync.release();
998          awaitTermination(t);
# Line 1134 | Line 1135 | public class AbstractQueuedSynchronizerT
1135  
1136          waitForQueuedThread(l, t);
1137          assertFalse(l.isSignalled());
1138 <        assertThreadStaysAlive(t);
1138 >        assertThreadBlocks(t, Thread.State.WAITING);
1139          assertHasSharedQueuedThreads(l, t);
1140          assertTrue(l.releaseShared(0));
1141          assertTrue(l.isSignalled());
# Line 1159 | Line 1160 | public class AbstractQueuedSynchronizerT
1160  
1161          waitForQueuedThread(l, t);
1162          assertFalse(l.isSignalled());
1163 <        assertThreadStaysAlive(t);
1163 >        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
1164          assertTrue(l.releaseShared(0));
1165          assertTrue(l.isSignalled());
1166          awaitTermination(t);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines