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

Comparing jsr166/src/test/tck/AbstractQueuedLongSynchronizerTest.java (file contents):
Revision 1.37 by jsr166, Sun Jan 1 20:34:39 2017 UTC vs.
Revision 1.41 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 AbstractQueuedLongSynchronizerTest extends JSR166TestCase {
24      public static void main(String[] args) {
25          main(suite(), args);
# Line 965 | Line 966 | public class AbstractQueuedLongSynchroni
966       */
967      public void testAwaitUninterruptibly() {
968          final Mutex sync = new Mutex();
969 <        final ConditionObject c = sync.newCondition();
969 >        final ConditionObject condition = sync.newCondition();
970          final BooleanLatch pleaseInterrupt = new BooleanLatch();
971          Thread t = newStartedThread(new CheckedRunnable() {
972              public void realRun() {
973                  sync.acquire();
974                  assertTrue(pleaseInterrupt.releaseShared(0));
975 <                c.awaitUninterruptibly();
975 >                condition.awaitUninterruptibly();
976                  assertTrue(Thread.interrupted());
977 <                assertHasWaitersLocked(sync, c, NO_THREADS);
977 >                assertHasWaitersLocked(sync, condition, NO_THREADS);
978                  sync.release();
979              }});
980  
981          pleaseInterrupt.acquireShared(0);
982          sync.acquire();
983 <        assertHasWaitersLocked(sync, c, t);
983 >        assertHasWaitersLocked(sync, condition, t);
984          sync.release();
985          t.interrupt();
986 <        assertHasWaitersUnlocked(sync, c, t);
987 <        assertThreadStaysAlive(t);
986 >        assertHasWaitersUnlocked(sync, condition, t);
987 >        assertThreadBlocks(t, Thread.State.WAITING);
988          sync.acquire();
989 <        assertHasWaitersLocked(sync, c, t);
989 >        assertHasWaitersLocked(sync, condition, t);
990          assertHasExclusiveQueuedThreads(sync, NO_THREADS);
991 <        c.signal();
992 <        assertHasWaitersLocked(sync, c, NO_THREADS);
991 >        condition.signal();
992 >        assertHasWaitersLocked(sync, condition, NO_THREADS);
993          assertHasExclusiveQueuedThreads(sync, t);
994          sync.release();
995          awaitTermination(t);
# Line 1131 | Line 1132 | public class AbstractQueuedLongSynchroni
1132  
1133          waitForQueuedThread(l, t);
1134          assertFalse(l.isSignalled());
1135 <        assertThreadStaysAlive(t);
1135 >        assertThreadBlocks(t, Thread.State.WAITING);
1136          assertHasSharedQueuedThreads(l, t);
1137          assertTrue(l.releaseShared(0));
1138          assertTrue(l.isSignalled());
# Line 1156 | Line 1157 | public class AbstractQueuedLongSynchroni
1157  
1158          waitForQueuedThread(l, t);
1159          assertFalse(l.isSignalled());
1160 <        assertThreadStaysAlive(t);
1160 >        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
1161          assertTrue(l.releaseShared(0));
1162          assertTrue(l.isSignalled());
1163          awaitTermination(t);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines