[cvs] / jsr166 / src / test / tck / AbstractQueuedLongSynchronizerTest.java Repository:
ViewVC logotype

Diff of /jsr166/src/test/tck/AbstractQueuedLongSynchronizerTest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.37, Sun Jan 1 20:34:39 2017 UTC revision 1.38, Sun May 14 02:16:56 2017 UTC
# Line 965  Line 965 
965       */       */
966      public void testAwaitUninterruptibly() {      public void testAwaitUninterruptibly() {
967          final Mutex sync = new Mutex();          final Mutex sync = new Mutex();
968          final ConditionObject c = sync.newCondition();          final ConditionObject condition = sync.newCondition();
969          final BooleanLatch pleaseInterrupt = new BooleanLatch();          final BooleanLatch pleaseInterrupt = new BooleanLatch();
970          Thread t = newStartedThread(new CheckedRunnable() {          Thread t = newStartedThread(new CheckedRunnable() {
971              public void realRun() {              public void realRun() {
972                  sync.acquire();                  sync.acquire();
973                  assertTrue(pleaseInterrupt.releaseShared(0));                  assertTrue(pleaseInterrupt.releaseShared(0));
974                  c.awaitUninterruptibly();                  condition.awaitUninterruptibly();
975                  assertTrue(Thread.interrupted());                  assertTrue(Thread.interrupted());
976                  assertHasWaitersLocked(sync, c, NO_THREADS);                  assertHasWaitersLocked(sync, condition, NO_THREADS);
977                  sync.release();                  sync.release();
978              }});              }});
979    
980          pleaseInterrupt.acquireShared(0);          pleaseInterrupt.acquireShared(0);
981          sync.acquire();          sync.acquire();
982          assertHasWaitersLocked(sync, c, t);          assertHasWaitersLocked(sync, condition, t);
983          sync.release();          sync.release();
984          t.interrupt();          t.interrupt();
985          assertHasWaitersUnlocked(sync, c, t);          assertHasWaitersUnlocked(sync, condition, t);
986          assertThreadStaysAlive(t);          assertThreadBlocks(t, Thread.State.WAITING);
987          sync.acquire();          sync.acquire();
988          assertHasWaitersLocked(sync, c, t);          assertHasWaitersLocked(sync, condition, t);
989          assertHasExclusiveQueuedThreads(sync, NO_THREADS);          assertHasExclusiveQueuedThreads(sync, NO_THREADS);
990          c.signal();          condition.signal();
991          assertHasWaitersLocked(sync, c, NO_THREADS);          assertHasWaitersLocked(sync, condition, NO_THREADS);
992          assertHasExclusiveQueuedThreads(sync, t);          assertHasExclusiveQueuedThreads(sync, t);
993          sync.release();          sync.release();
994          awaitTermination(t);          awaitTermination(t);

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.38

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8