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

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8