synchronized

JVM
1.0
inline fun <R> synchronized(lock: Any, block: () -> R): R
(source)
JS
1.1
@DeprecatedSinceKotlin("1.6", "1.9") inline fun <R> synchronized(
    lock: Any,
    block: () -> R
): R

(source)
Deprecated: Synchronization on any object is not supported in Kotlin/JS

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