withLock

inline suspend fun <T> Mutex.withLock(
    owner: Any? = null,
    action: () -> T
): T
(source)

Platform and version requirements: JVM

Executes the given action under this mutex’s lock.

Parameters

owner - Optional owner token for debugging.

Return the return value of the action.