Support using an executor as a function to execute a block.

This commit is contained in:
Hiram Chirino
2012-06-09 08:27:47 -04:00
parent 43a00b9787
commit 7cbb8a19fb
2 changed files with 29 additions and 0 deletions
@@ -0,0 +1,21 @@
package concurrent
import kotlin.concurrent.*
import kotlin.test.*
import org.junit.Test as test
import java.util.concurrent.*
import java.util.concurrent.TimeUnit.*
class ThreadTest {
test fun scheduledTask() {
val pool = Executors.newFixedThreadPool(1).sure()
val countDown = CountDownLatch(1)
pool {
countDown.countDown()
}
assertTrue(countDown.await(2, SECONDS), "Count down is executed")
}
}