ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/SemaphoreTest.java
(Generate patch)

Comparing jsr166/src/test/tck/SemaphoreTest.java (file contents):
Revision 1.26 by jsr166, Tue Mar 15 19:47:07 2011 UTC vs.
Revision 1.27 by dl, Fri May 6 11:22:07 2011 UTC

# Line 169 | Line 169 | public class SemaphoreTest extends JSR16
169              }});
170  
171          t.start();
172 <        Thread.sleep(SHORT_DELAY_MS);
172 >        delay(SHORT_DELAY_MS);
173          s.release();
174          s.release();
175          s.acquire();
# Line 193 | Line 193 | public class SemaphoreTest extends JSR16
193              }});
194  
195          t.start();
196 <        Thread.sleep(SHORT_DELAY_MS);
196 >        delay(SHORT_DELAY_MS);
197          s.release();
198          s.release();
199          s.acquireUninterruptibly();
# Line 238 | Line 238 | public class SemaphoreTest extends JSR16
238              }});
239  
240          t.start();
241 <        Thread.sleep(SHORT_DELAY_MS);
241 >        delay(SHORT_DELAY_MS);
242          t.interrupt();
243          t.join();
244      }
# Line 255 | Line 255 | public class SemaphoreTest extends JSR16
255              }});
256  
257          t.start();
258 <        Thread.sleep(SHORT_DELAY_MS);
258 >        delay(SHORT_DELAY_MS);
259          t.interrupt();
260          t.join();
261      }
# Line 270 | Line 270 | public class SemaphoreTest extends JSR16
270          assertFalse(lock.hasQueuedThreads());
271          lock.acquireUninterruptibly();
272          t1.start();
273 <        Thread.sleep(SHORT_DELAY_MS);
273 >        delay(SHORT_DELAY_MS);
274          assertTrue(lock.hasQueuedThreads());
275          t2.start();
276 <        Thread.sleep(SHORT_DELAY_MS);
276 >        delay(SHORT_DELAY_MS);
277          assertTrue(lock.hasQueuedThreads());
278          t1.interrupt();
279 <        Thread.sleep(SHORT_DELAY_MS);
279 >        delay(SHORT_DELAY_MS);
280          assertTrue(lock.hasQueuedThreads());
281          lock.release();
282 <        Thread.sleep(SHORT_DELAY_MS);
282 >        delay(SHORT_DELAY_MS);
283          assertFalse(lock.hasQueuedThreads());
284          t1.join();
285          t2.join();
# Line 295 | Line 295 | public class SemaphoreTest extends JSR16
295          assertEquals(0, lock.getQueueLength());
296          lock.acquireUninterruptibly();
297          t1.start();
298 <        Thread.sleep(SHORT_DELAY_MS);
298 >        delay(SHORT_DELAY_MS);
299          assertEquals(1, lock.getQueueLength());
300          t2.start();
301 <        Thread.sleep(SHORT_DELAY_MS);
301 >        delay(SHORT_DELAY_MS);
302          assertEquals(2, lock.getQueueLength());
303          t1.interrupt();
304 <        Thread.sleep(SHORT_DELAY_MS);
304 >        delay(SHORT_DELAY_MS);
305          assertEquals(1, lock.getQueueLength());
306          lock.release();
307 <        Thread.sleep(SHORT_DELAY_MS);
307 >        delay(SHORT_DELAY_MS);
308          assertEquals(0, lock.getQueueLength());
309          t1.join();
310          t2.join();
# Line 321 | Line 321 | public class SemaphoreTest extends JSR16
321          lock.acquireUninterruptibly();
322          assertTrue(lock.getQueuedThreads().isEmpty());
323          t1.start();
324 <        Thread.sleep(SHORT_DELAY_MS);
324 >        delay(SHORT_DELAY_MS);
325          assertTrue(lock.getQueuedThreads().contains(t1));
326          t2.start();
327 <        Thread.sleep(SHORT_DELAY_MS);
327 >        delay(SHORT_DELAY_MS);
328          assertTrue(lock.getQueuedThreads().contains(t1));
329          assertTrue(lock.getQueuedThreads().contains(t2));
330          t1.interrupt();
331 <        Thread.sleep(SHORT_DELAY_MS);
331 >        delay(SHORT_DELAY_MS);
332          assertFalse(lock.getQueuedThreads().contains(t1));
333          assertTrue(lock.getQueuedThreads().contains(t2));
334          lock.release();
335 <        Thread.sleep(SHORT_DELAY_MS);
335 >        delay(SHORT_DELAY_MS);
336          assertTrue(lock.getQueuedThreads().isEmpty());
337          t1.join();
338          t2.join();
# Line 531 | Line 531 | public class SemaphoreTest extends JSR16
531              }});
532  
533          t.start();
534 <        Thread.sleep(SHORT_DELAY_MS);
534 >        delay(SHORT_DELAY_MS);
535          s.release();
536          s.release();
537          s.release();
# Line 556 | Line 556 | public class SemaphoreTest extends JSR16
556              }});
557  
558          t.start();
559 <        Thread.sleep(SHORT_DELAY_MS);
559 >        delay(SHORT_DELAY_MS);
560          s.release(2);
561          s.acquire(2);
562          s.release(1);
# Line 577 | Line 577 | public class SemaphoreTest extends JSR16
577              }});
578  
579          t.start();
580 <        Thread.sleep(SHORT_DELAY_MS);
580 >        delay(SHORT_DELAY_MS);
581          s.release(6);
582          s.acquire(2);
583          s.acquire(2);
# Line 644 | Line 644 | public class SemaphoreTest extends JSR16
644              }});
645  
646          t.start();
647 <        Thread.sleep(SHORT_DELAY_MS);
647 >        delay(SHORT_DELAY_MS);
648          t.interrupt();
649          t.join();
650      }
# Line 661 | Line 661 | public class SemaphoreTest extends JSR16
661              }});
662  
663          t.start();
664 <        Thread.sleep(SHORT_DELAY_MS);
664 >        delay(SHORT_DELAY_MS);
665          t.interrupt();
666          t.join();
667      }
# Line 678 | Line 678 | public class SemaphoreTest extends JSR16
678              }});
679  
680          t.start();
681 <        Thread.sleep(SHORT_DELAY_MS);
681 >        delay(SHORT_DELAY_MS);
682          t.interrupt();
683          t.join();
684      }
# Line 695 | Line 695 | public class SemaphoreTest extends JSR16
695              }});
696  
697          t.start();
698 <        Thread.sleep(SHORT_DELAY_MS);
698 >        delay(SHORT_DELAY_MS);
699          t.interrupt();
700          t.join();
701      }
# Line 710 | Line 710 | public class SemaphoreTest extends JSR16
710          assertEquals(0, lock.getQueueLength());
711          lock.acquireUninterruptibly();
712          t1.start();
713 <        Thread.sleep(SHORT_DELAY_MS);
713 >        delay(SHORT_DELAY_MS);
714          assertEquals(1, lock.getQueueLength());
715          t2.start();
716 <        Thread.sleep(SHORT_DELAY_MS);
716 >        delay(SHORT_DELAY_MS);
717          assertEquals(2, lock.getQueueLength());
718          t1.interrupt();
719 <        Thread.sleep(SHORT_DELAY_MS);
719 >        delay(SHORT_DELAY_MS);
720          assertEquals(1, lock.getQueueLength());
721          lock.release();
722 <        Thread.sleep(SHORT_DELAY_MS);
722 >        delay(SHORT_DELAY_MS);
723          assertEquals(0, lock.getQueueLength());
724          t1.join();
725          t2.join();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines