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

Comparing jsr166/src/test/tck/ReentrantLockTest.java (file contents):
Revision 1.41 by jsr166, Sat May 7 02:51:33 2011 UTC vs.
Revision 1.42 by jsr166, Sat May 7 03:12:48 2011 UTC

# Line 131 | Line 131 | public class ReentrantLockTest extends J
131          lock.unlock();
132          delay(SHORT_DELAY_MS);
133          assertFalse(lock.hasQueuedThreads());
134 <        t1.join();
135 <        t2.join();
134 >        awaitTermination(t1);
135 >        awaitTermination(t2);
136      }
137  
138      /**
# Line 156 | Line 156 | public class ReentrantLockTest extends J
156          lock.unlock();
157          delay(SHORT_DELAY_MS);
158          assertEquals(0, lock.getQueueLength());
159 <        t1.join();
160 <        t2.join();
159 >        awaitTermination(t1);
160 >        awaitTermination(t2);
161      }
162  
163      /**
# Line 181 | Line 181 | public class ReentrantLockTest extends J
181          lock.unlock();
182          delay(SHORT_DELAY_MS);
183          assertEquals(0, lock.getQueueLength());
184 <        t1.join();
185 <        t2.join();
184 >        awaitTermination(t1);
185 >        awaitTermination(t2);
186      }
187  
188      /**
# Line 222 | Line 222 | public class ReentrantLockTest extends J
222          assertFalse(sync.hasQueuedThread(t1));
223          delay(SHORT_DELAY_MS);
224          assertFalse(sync.hasQueuedThread(t2));
225 <        t1.join();
226 <        t2.join();
225 >        awaitTermination(t1);
226 >        awaitTermination(t2);
227      }
228  
229  
# Line 251 | Line 251 | public class ReentrantLockTest extends J
251          lock.unlock();
252          delay(SHORT_DELAY_MS);
253          assertTrue(lock.getQueuedThreads().isEmpty());
254 <        t1.join();
255 <        t2.join();
254 >        awaitTermination(t1);
255 >        awaitTermination(t2);
256      }
257  
258  
# Line 269 | Line 269 | public class ReentrantLockTest extends J
269  
270          delay(SHORT_DELAY_MS);
271          t.interrupt();
272 <        t.join();
272 >        awaitTermination(t);
273      }
274  
275  
# Line 284 | Line 284 | public class ReentrantLockTest extends J
284                  assertFalse(lock.tryLock());
285              }});
286  
287 <        t.join();
287 >        awaitTermination(t);
288          lock.unlock();
289      }
290  
# Line 299 | Line 299 | public class ReentrantLockTest extends J
299                  assertFalse(lock.tryLock(1, MILLISECONDS));
300              }});
301  
302 <        t.join();
302 >        awaitTermination(t);
303          lock.unlock();
304      }
305  
# Line 337 | Line 337 | public class ReentrantLockTest extends J
337  
338          delay(SHORT_DELAY_MS);
339          assertTrue(lock.isLocked());
340 <        t.join();
340 >        awaitTermination(t);
341          assertFalse(lock.isLocked());
342      }
343  
# Line 353 | Line 353 | public class ReentrantLockTest extends J
353          t.interrupt();
354          delay(SHORT_DELAY_MS);
355          lock.unlock();
356 <        t.join();
356 >        awaitTermination(t);
357      }
358  
359      /**
# Line 367 | Line 367 | public class ReentrantLockTest extends J
367          t.interrupt();
368          assertTrue(lock.isLocked());
369          assertTrue(lock.isHeldByCurrentThread());
370 <        t.join();
370 >        awaitTermination(t);
371      }
372  
373      /**
# Line 446 | Line 446 | public class ReentrantLockTest extends J
446          lock.lock();
447          c.signal();
448          lock.unlock();
449 <        t.join(SHORT_DELAY_MS);
450 <        assertFalse(t.isAlive());
449 >        awaitTermination(t);
450      }
451  
452      /**
# Line 589 | Line 588 | public class ReentrantLockTest extends J
588          assertFalse(lock.hasWaiters(c));
589          assertEquals(0, lock.getWaitQueueLength(c));
590          lock.unlock();
591 <        t.join(SHORT_DELAY_MS);
593 <        assertFalse(t.isAlive());
591 >        awaitTermination(t);
592      }
593  
594      /**
# Line 630 | Line 628 | public class ReentrantLockTest extends J
628          assertFalse(lock.hasWaiters(c));
629          assertEquals(0, lock.getWaitQueueLength(c));
630          lock.unlock();
631 <        t1.join(SHORT_DELAY_MS);
632 <        t2.join(SHORT_DELAY_MS);
635 <        assertFalse(t1.isAlive());
636 <        assertFalse(t2.isAlive());
631 >        awaitTermination(t1);
632 >        awaitTermination(t2);
633      }
634  
635      /**
# Line 676 | Line 672 | public class ReentrantLockTest extends J
672          assertFalse(lock.hasWaiters(c));
673          assertTrue(lock.getWaitingThreads(c).isEmpty());
674          lock.unlock();
675 <        t1.join(SHORT_DELAY_MS);
676 <        t2.join(SHORT_DELAY_MS);
681 <        assertFalse(t1.isAlive());
682 <        assertFalse(t2.isAlive());
675 >        awaitTermination(t1);
676 >        awaitTermination(t2);
677      }
678  
679      /** A helper class for uninterruptible wait tests */
# Line 751 | Line 745 | public class ReentrantLockTest extends J
745  
746          delay(SHORT_DELAY_MS);
747          t.interrupt();
748 <        t.join(SHORT_DELAY_MS);
755 <        assertFalse(t.isAlive());
748 >        awaitTermination(t);
749      }
750  
751      /**
# Line 769 | Line 762 | public class ReentrantLockTest extends J
762  
763          delay(SHORT_DELAY_MS);
764          t.interrupt();
765 <        t.join(SHORT_DELAY_MS);
773 <        assertFalse(t.isAlive());
765 >        awaitTermination(t);
766      }
767  
768      /**
# Line 788 | Line 780 | public class ReentrantLockTest extends J
780  
781          delay(SHORT_DELAY_MS);
782          t.interrupt();
783 <        t.join(SHORT_DELAY_MS);
792 <        assertFalse(t.isAlive());
783 >        awaitTermination(t);
784      }
785  
786      /**
# Line 816 | Line 807 | public class ReentrantLockTest extends J
807          lock.lock();
808          c.signalAll();
809          lock.unlock();
810 <        t1.join(SHORT_DELAY_MS);
811 <        t2.join(SHORT_DELAY_MS);
821 <        assertFalse(t1.isAlive());
822 <        assertFalse(t2.isAlive());
810 >        awaitTermination(t1);
811 >        awaitTermination(t2);
812      }
813  
814      /**
# Line 852 | Line 841 | public class ReentrantLockTest extends J
841          lock.lock();
842          c.signalAll();
843          lock.unlock();
844 <        t1.join(SHORT_DELAY_MS);
845 <        t2.join(SHORT_DELAY_MS);
857 <        assertFalse(t1.isAlive());
858 <        assertFalse(t2.isAlive());
844 >        awaitTermination(t1);
845 >        awaitTermination(t2);
846      }
847  
848      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines