Files
kotlin-fork/compiler/testData/codegen/box/fullJdk/intCountDownLatchExtension.kt
T
Alexander Udalov 20e36438e2 Move some tests from boxWithStdlib/ to box/
Move those tests which do not require neither stdlib nor reflect
2016-03-09 10:25:38 +03:00

24 lines
437 B
Kotlin
Vendored

// FULL_JDK
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.locks.ReentrantLock;
fun <T> Int.latch(op: CountDownLatch.() -> T) : T {
val cdl = CountDownLatch(this)
val res = cdl.op()
cdl.await()
return res
}
fun id(op : ()->Unit) = op()
fun box() : String {
1.latch{
id {
countDown()
}
}
return "OK"
}