Releases all held locks.
StaticfromAcquires locks on all provided locks, waiting as necessary.
The locks are acquired in a globally consistent order to prevent deadlocks.
If any lock cannot be acquired, all previously acquired locks are released and the error is thrown.
The iterable of locks to acquire.
Optionalsignal: AbortSignal | nullAn optional AbortSignal to cancel the acquire operation.
A promise that resolves to a LockHold when all locks are acquired.
StatictryTries to acquire locks on all provided locks without waiting.
The locks are acquired in a globally consistent order to prevent deadlocks.
If any lock is already held, all previously acquired locks are released and
the function returns null. Otherwise, a LockHold is returned.
The locks to acquire.
A promise that resolves to a LockHold if all locks were acquired,
or null if any lock could not be acquired.
A hold on one or more locks.
This class represents a collection of locks that have been acquired. It provides methods to release all held locks in a safe manner.
Locks are acquired in a globally consistent order to prevent deadlocks.
When a LockHold is no longer needed, the
unlockmethod should be called to release all held locks. Alternatively, it can be used with theusingstatement for automatic disposal.Locks are released in the reverse order of acquisition to maintain proper locking semantics.
Example
Example: Using with `using` statement