found an error in the junit test after a long time
authorerik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Sun, 15 Feb 2009 16:10:15 +0000 (16:10 +0000)
committererik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Sun, 15 Feb 2009 16:10:15 +0000 (16:10 +0000)
trunk/support/general/src/test/java/org/wamblee/concurrency/ReadWriteLockTest.java

index 2c159e9437639c4c563b12d0b0010003ffedfe81..40302f76a95935b4b0346ea80b6a80819d65239e 100644 (file)
@@ -220,13 +220,15 @@ public class ReadWriteLockTest extends TestCase {
         WriteLocker writeLocker = new WriteLocker(_lock, this, TWO_SECONDS);
         Thread      t3          = new Thread(writeLocker);
 
-        t1.start(); // acquire read lock
+        t1.start(); // acquire read lock [0, 2.5]
         Thread.sleep(ONE_SECOND);
+        // t = 1
         assertTrue(getReaderCount() == 1);
-        t2.start();
+        t2.start(); // acquire read lock [1, 3.5]
         Thread.sleep(HALF_SECOND);
+        // t = 1.5
         assertTrue(getReaderCount() == 2);
-        t3.start();
+        t3.start(); // write lock 
         Thread.sleep(HALF_SECOND);
 
         // 2 seconds, 
@@ -238,7 +240,7 @@ public class ReadWriteLockTest extends TestCase {
         // have been released.
         assertTrue(getReaderCount() == 1);
         assertTrue(getWriterCount() == 0);
-        Thread.sleep(HALF_SECOND);
+        Thread.sleep(ONE_SECOND);
 
         // 4 seconds underway, write lock must have 
         // been acquired.