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

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8