Mutex
interface Mutex
(source)Platform and version requirements: JVM
Mutual exclusion for coroutines.
Mutex has two states: locked and unlocked. It is non-reentrant, that is invoking lock even from the same thread/coroutine that currently holds the lock still suspends the invoker.
Properties
abstract val isLocked: Boolean Returns |
|
abstract val onLock: SelectClause2<Any?, Mutex> Clause for select expression of lock suspending function that selects when the mutex is locked.
Additional parameter for the clause in the |
Functions
Checks mutex locked by owner |
|
Locks this mutex, suspending caller while the mutex is locked. |
|
Tries to lock this mutex, returning |
|
Unlocks this mutex. Throws IllegalStateException if invoked on a mutex that is not locked. |
Extension Functions
Executes the given action under this mutex’s lock. |