Mutex class
A reentrant mutex implementation supporting read-write locks.
Constructors
- Mutex({LockPolicy lockPolicy = LockPolicy.fair})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- lockPolicy → LockPolicy
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
isLocked(
) → bool - Checks if the mutex is currently locked.
-
isReadLocked(
) → bool - Checks if the mutex is currently read-locked.
-
isWriteLocked(
) → bool - Checks if the mutex is currently write-locked.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
protect<
T> (Future< T> action(), {CancellationToken? cancellationToken, Duration? timeout}) → Future<T> - Protects a critical section with a write lock.
-
protectRead<
T> (Future< T> action(), {CancellationToken? cancellationToken, Duration? timeout}) → Future<T> -
Executes
action
within a read lock. -
protectWrite<
T> (Future< T> action(), {CancellationToken? cancellationToken, Duration? timeout}) → Future<T> -
Executes
action
within a write lock. -
toString(
) → String -
A string representation of this object.
inherited
-
tryLock<
T> (Future< T> action(), {CancellationToken? cancellationToken, Duration? timeout}) → Future<T?> - Attempts to acquire the lock without waiting.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited