c7435ba760
We are going to deprecate `WITH_RUNTIME` directive. The main reason behind this change is that `WITH_STDLIB` directive better describes its meaning, specifically it will add kotlin stdlib to test's classpath.
20 lines
492 B
Kotlin
Vendored
20 lines
492 B
Kotlin
Vendored
// TARGET_BACKEND: JVM_IR
|
|
// WITH_STDLIB
|
|
// FILE: mySynchronized.kt
|
|
|
|
import kotlin.jvm.internal.unsafe.*
|
|
|
|
public inline fun <R> mySynchronized(lock: Any, block: () -> R): R {
|
|
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE", "INVISIBLE_MEMBER")
|
|
monitorEnter(lock)
|
|
try {
|
|
return block()
|
|
}
|
|
finally {
|
|
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE", "INVISIBLE_MEMBER")
|
|
monitorExit(lock)
|
|
}
|
|
}
|
|
|
|
// FILE: box.kt
|
|
fun box() = mySynchronized(Any()) { "OK" } |