17 |
|
import java.util.concurrent.locks.Lock; |
18 |
|
import java.util.concurrent.locks.ReentrantReadWriteLock; |
19 |
|
|
20 |
– |
import junit.framework.AssertionFailedError; |
20 |
|
import junit.framework.Test; |
21 |
|
import junit.framework.TestSuite; |
22 |
|
|
23 |
+ |
@SuppressWarnings("WaitNotInLoop") // we implement spurious-wakeup freedom |
24 |
|
public class ReentrantReadWriteLockTest extends JSR166TestCase { |
25 |
|
public static void main(String[] args) { |
26 |
|
main(suite(), args); |
87 |
|
long startTime = System.nanoTime(); |
88 |
|
while (!lock.hasQueuedThread(t)) { |
89 |
|
if (millisElapsedSince(startTime) > LONG_DELAY_MS) |
90 |
< |
throw new AssertionFailedError("timed out"); |
90 |
> |
throw new AssertionError("timed out"); |
91 |
|
Thread.yield(); |
92 |
|
} |
93 |
|
assertTrue(t.isAlive()); |