156 |
|
*/ |
157 |
|
public void testWriteLockInterruptibly_Interrupted() { |
158 |
|
final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); |
159 |
– |
lock.writeLock().lock(); |
159 |
|
Thread t = new Thread(new Runnable() { |
160 |
|
public void run() { |
161 |
|
try { |
162 |
|
lock.writeLock().lockInterruptibly(); |
163 |
< |
threadShouldThrow(); |
163 |
> |
lock.writeLock().unlock(); |
164 |
> |
lock.writeLock().lockInterruptibly(); |
165 |
> |
lock.writeLock().unlock(); |
166 |
|
} catch(InterruptedException success){} |
167 |
|
} |
168 |
|
}); |
169 |
|
try { |
170 |
+ |
lock.writeLock().lock(); |
171 |
|
t.start(); |
172 |
|
t.interrupt(); |
173 |
|
lock.writeLock().unlock(); |
211 |
|
public void run() { |
212 |
|
try { |
213 |
|
lock.readLock().lockInterruptibly(); |
212 |
– |
threadShouldThrow(); |
214 |
|
} catch(InterruptedException success){} |
215 |
|
} |
216 |
|
}); |