From e19acf4922eaf707cfc4a7770c052573a06c9bc5 Mon Sep 17 00:00:00 2001 From: Alex Tkachman Date: Mon, 19 Dec 2011 15:57:48 +0200 Subject: [PATCH] LockPerf benchmark --- examples/src/benchmarks/LockPerf.kt | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/examples/src/benchmarks/LockPerf.kt b/examples/src/benchmarks/LockPerf.kt index c7a61eda5ed..064280780db 100644 --- a/examples/src/benchmarks/LockPerf.kt +++ b/examples/src/benchmarks/LockPerf.kt @@ -1,20 +1,11 @@ namespace lockperformance +import std.concurrent.* + import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.CountDownLatch; import java.util.concurrent.locks.ReentrantLock; -fun thread(f: fun ()) { - val thread = Thread( - object: Runnable { - override fun run() { - f() - } - } - ) - thread.start() -} - fun Int.latch(op: fun CountDownLatch.() : T) : T { val cdl = CountDownLatch(this) val res = cdl.op() @@ -22,7 +13,7 @@ fun Int.latch(op: fun CountDownLatch.() : T) : T { return res } -fun Int.times(action: fun Int.()) { +fun Int.times(action: fun():Unit) { for(i in 0..this-1) action() }