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

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

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

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

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.54

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8