synchronized

inline fun <R> synchronized(lock: Any, block: () -> R): R(source)

Deprecated

Warning since 1.6

Synchronization on any object is not supported in Kotlin/JS

Replace with

run(block)

Since Kotlin

1.1
inline fun <R> synchronized(lock: Any, block: () -> R): R(source)

Executes the given function block while holding the monitor of the given object lock.

Since Kotlin

1.0