[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.43, Fri Jan 18 04:23:28 2013 UTC revision 1.44, Thu May 2 18:01:09 2013 UTC
# Line 1190  Line 1190 
1190       */       */
1191      public void testTryAcquireSharedNanos_Timeout() {      public void testTryAcquireSharedNanos_Timeout() {
1192          final BooleanLatch l = new BooleanLatch();          final BooleanLatch l = new BooleanLatch();
1193            final BooleanLatch observedQueued = new BooleanLatch();
1194            final long timeoutMillis = timeoutMillis();
1195          Thread t = newStartedThread(new CheckedRunnable() {          Thread t = newStartedThread(new CheckedRunnable() {
1196              public void realRun() throws InterruptedException {              public void realRun() throws InterruptedException {
1197                  assertFalse(l.isSignalled());                  assertFalse(l.isSignalled());
1198                    for (long millis = timeoutMillis();
1199                         !observedQueued.isSignalled();
1200                         millis *= 2) {
1201                        long nanos = MILLISECONDS.toNanos(millis);
1202                  long startTime = System.nanoTime();                  long startTime = System.nanoTime();
                 long nanos = MILLISECONDS.toNanos(timeoutMillis());  
1203                  assertFalse(l.tryAcquireSharedNanos(0, nanos));                  assertFalse(l.tryAcquireSharedNanos(0, nanos));
1204                  assertTrue(millisElapsedSince(startTime) >= timeoutMillis());                      assertTrue(millisElapsedSince(startTime) >= millis);
1205                    }
1206                  assertFalse(l.isSignalled());                  assertFalse(l.isSignalled());
1207              }});              }});
1208    
1209          waitForQueuedThread(l, t);          waitForQueuedThread(l, t);
1210            observedQueued.releaseShared(0);
1211          assertFalse(l.isSignalled());          assertFalse(l.isSignalled());
1212          awaitTermination(t);          awaitTermination(t);
1213          assertFalse(l.isSignalled());          assertFalse(l.isSignalled());

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.44

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8