Mutex class sealed

A mutex synchronization primitive.

Mutex can be used to synchronize access to a native resource shared between multiple threads.

Mutex object can not be directly sent to other isolates via a SendPort, but it can be converted to a Sendable<Mutex> via asSendable getter.

Mutex objects are owned by an isolate which created them.

Implemented types

Constructors

Mutex()
factory

Properties

asSendable Sendable<Mutex>
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
runLocked<R>(R action(), {Duration? timeout}) → R
Run the given synchronous action under a mutex. The lock will return if the lock is gained. If a timeout occurs then a TimeoutException is thrown.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited