Files
kotlin-fork/compiler/testData/codegen/extensionFunctions/intCountDownLatchExtension.kt
T
Alexander Udalov 0df71bd696 Refactor codegen tests
- initialize environment only once in setUp()
- add comments on why some tests are disabled
- modify and rename some tests
- re-enable now working tests
- extract some tests into files with box()
- remove useless 'throws' declarations and commented code
2013-01-24 21:12:27 +04:00

22 lines
424 B
Kotlin

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"
}