unlock

abstract fun unlock(owner: Any? = null)(source)

Unlocks this mutex. Throws IllegalStateException if invoked on a mutex that is not locked or was locked with a different owner token (by identity).

It is recommended to use withLock for safety reasons, so that the acquired lock is always released at the end of the critical section, and unlock is never invoked before a successful lock acquisition.

Parameters

owner

Optional owner token for debugging. When owner is specified (non-null value) and this mutex was locked with the different token (by identity), this function throws IllegalStateException.