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

Comparing jsr166/src/test/tck/ReentrantReadWriteLockTest.java (file contents):
Revision 1.45 by jsr166, Sun May 1 23:49:41 2011 UTC vs.
Revision 1.46 by jsr166, Mon May 2 00:03:34 2011 UTC

# Line 59 | Line 59 | public class ReentrantReadWriteLockTest
59      }
60  
61      /**
62 +     * Releases lock, checking that it had a hold count of 1.
63 +     */
64 +    void releaseLock(ReentrantReadWriteLock.WriteLock lock) {
65 +        assertTrue(lock.isHeldByCurrentThread());
66 +        lock.unlock();
67 +        assertFalse(lock.isHeldByCurrentThread());
68 +    }
69 +
70 +    /**
71       * Constructor sets given fairness, and is in unlocked state
72       */
73      public void testConstructor() {
# Line 194 | Line 203 | public class ReentrantReadWriteLockTest
203          Thread t = newStartedThread(new CheckedInterruptedRunnable() {
204              public void realRun() throws InterruptedException {
205                  lock.writeLock().lockInterruptibly();
197                lock.writeLock().unlock();
198                lock.writeLock().lockInterruptibly();
199                lock.writeLock().unlock();
206              }});
207  
208          Thread.sleep(SHORT_DELAY_MS);
209          t.interrupt();
204        Thread.sleep(SHORT_DELAY_MS);
205        lock.writeLock().unlock();
210          t.join();
211 +        releaseLock(lock.writeLock());
212      }
213  
214      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines