MultiLock class
A Lock that atomically acquires several other locks together.
synchronized acquires each underlying lock in the order given to MultiLock.new, running the computation once all of them are held, then releases them in reverse order. To avoid deadlocks, always acquire the same set of underlying locks in the same relative order across every MultiLock (or direct Lock.synchronized call) that shares any of them.
- Implemented types
- Available extensions
Constructors
Properties
- canLock → bool
-
Whether calling synchronized right now would be able to acquire the
lock without waiting.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- inLock → bool
-
For a reentrant lock, whether the current Zone is nested inside a
synchronized call on this lock (so a further nested call would not
deadlock).
no setteroverride
- locked → bool
-
Whether the lock is currently held, i.e. a call to synchronized is
currently running (or waiting for a nested synchronized call to
finish, for a reentrant lock).
no setteroverride
- 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> -
Runs
computationonce this lock is available, preventing any other call to synchronized on this lock from running concurrently.override -
synchronizedSync<
T> (T computation(), {Duration? timeout}) → FutureOr< T> -
Available on Lock, provided by the TekartikLockExtension extension
Runs the synchronouscomputation, returning its result directly (not wrapped in a Future) if this lock can be acquired immediately (see Lock.canLock). -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited