Run the given function while the resource is locked. The lock will be released when the (async) input function resolves. This function should be used for operations that only require reading the resource.
As ReadWriteLocker.withReadLock but the locked function gets called with a maintainLock
callback function
to reset the lock expiration every time it is called.
The resulting promise will reject once the lock expires.
Identifier of the resource that needs to be locked.
A function to execute while the resource is locked. Receives a callback as input parameter to maintain the lock.
Run the given function while the resource is locked. The lock will be released when the (async) input function resolves. This function should be used for operations that could modify the resource.
As ReadWriteLocker.withWriteLock but the locked function gets called with a maintainLock
callback function to reset the lock expiration every time it is called.
The resulting promise will reject once the lock expires.
Identifier of the resource that needs to be locked.
A function to execute while the resource is locked. Receives a callback as input parameter to maintain the lock.
A ReadWriteLocker where the locks expire after a given time.