lock

suspend fun lock(key: K, owner: Any? = null)(source)

Suspends until the lock for key is acquired. Not re-entrant for the same key within the same coroutine.