[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.41, Sat May 21 06:24:33 2011 UTC revision 1.42, Fri Jun 3 05:07:14 2011 UTC
# Line 947  Line 947 
947      }      }
948    
949      /**      /**
950       * awaitUninterruptibly doesn't abort on interrupt       * awaitUninterruptibly is uninterruptible
951       */       */
952      public void testAwaitUninterruptibly() {      public void testAwaitUninterruptibly() {
953          final Mutex sync = new Mutex();          final Mutex sync = new Mutex();
954          final ConditionObject c = sync.newCondition();          final ConditionObject c = sync.newCondition();
955          final BooleanLatch acquired = new BooleanLatch();          final BooleanLatch pleaseInterrupt = new BooleanLatch();
956          Thread t = newStartedThread(new CheckedRunnable() {          Thread t = newStartedThread(new CheckedRunnable() {
957              public void realRun() {              public void realRun() {
958                  sync.acquire();                  sync.acquire();
959                  assertTrue(acquired.releaseShared(0));                  assertTrue(pleaseInterrupt.releaseShared(0));
960                  c.awaitUninterruptibly();                  c.awaitUninterruptibly();
961                  assertTrue(Thread.interrupted());                  assertTrue(Thread.interrupted());
962                  assertHasWaitersLocked(sync, c, NO_THREADS);                  assertHasWaitersLocked(sync, c, NO_THREADS);
963                  sync.release();                  sync.release();
964              }});              }});
965    
966          acquired.acquireShared(0);          pleaseInterrupt.acquireShared(0);
967          sync.acquire();          sync.acquire();
968          assertHasWaitersLocked(sync, c, t);          assertHasWaitersLocked(sync, c, t);
969          sync.release();          sync.release();
# Line 990  Line 990 
990      public void testInterruptible(final AwaitMethod awaitMethod) {      public void testInterruptible(final AwaitMethod awaitMethod) {
991          final Mutex sync = new Mutex();          final Mutex sync = new Mutex();
992          final ConditionObject c = sync.newCondition();          final ConditionObject c = sync.newCondition();
993          final BooleanLatch acquired = new BooleanLatch();          final BooleanLatch pleaseInterrupt = new BooleanLatch();
994          Thread t = newStartedThread(new CheckedInterruptedRunnable() {          Thread t = newStartedThread(new CheckedInterruptedRunnable() {
995              public void realRun() throws InterruptedException {              public void realRun() throws InterruptedException {
996                  sync.acquire();                  sync.acquire();
997                  assertTrue(acquired.releaseShared(0));                  assertTrue(pleaseInterrupt.releaseShared(0));
998                  await(c, awaitMethod);                  await(c, awaitMethod);
999              }});              }});
1000    
1001          acquired.acquireShared(0);          pleaseInterrupt.acquireShared(0);
1002          t.interrupt();          t.interrupt();
1003          awaitTermination(t);          awaitTermination(t);
1004      }      }

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8