annotations for j.u.c.locks + related fixes of tests

This commit is contained in:
Alex Tkachman
2012-09-26 18:52:46 +02:00
parent 7ed2126ebb
commit e2d514907a
3 changed files with 46 additions and 5 deletions
@@ -3,7 +3,7 @@ package kt1189
import java.util.concurrent.locks.ReentrantReadWriteLock
inline fun <T> ReentrantReadWriteLock.write(action: ()->T) : T {
val rl = readLock()!!
val rl = readLock()
var readCount = 0
val writeCount = getWriteHoldCount()
if(writeCount == 0) {
@@ -13,7 +13,7 @@ inline fun <T> ReentrantReadWriteLock.write(action: ()->T) : T {
rl.unlock()
}
val wl = writeLock()!!
val wl = writeLock()
wl.lock()
try {
return action()