withLock

fun withLock(work: () -> Unit)

Perform some work while holding an instance-level exclusive lock (if this structure is lock-enabled), or without a lock if this structure is not lock-enabled.

Parameters

work

Work to be executed.