Lock class abstract

Object providing the implicit lock.

A Lock can be reentrant (in this case it will use a Zone).

non-reentrant lock is used like an aync executor with a capacity of 1.

if timeout is not null, it will timeout after the specified duration.

Constructors

Lock({bool reentrant = false})
Creates a Lock object.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
inLock bool
for reentrant, test whether we are currently in the synchronized section. for non reentrant, it returns the locked status.
no setter
locked bool
returns true if the lock is currently locked.
no setter
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
synchronized<T>(FutureOr<T> computation(), {Duration? timeout}) Future<T>
Executes computation when lock is available.
toString() String
A string representation of this object.
inherited

Operators

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