-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the SharedTimedLockable interface
- Loading branch information
1 parent
a1b0187
commit 03166e7
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { SharedLockable } from "./sharedLockable"; | ||
|
||
/** | ||
* Extends the {@link SharedLockable} interface to include timed blocking. | ||
*/ | ||
export interface SharedTimedLockable extends SharedLockable { | ||
/** | ||
* Blocks for the provided duration or until a lock is acquired. | ||
* | ||
* @returns `true` if the lock was acquired, `false` otherwise. | ||
*/ | ||
tryLockSharedFor(timeout: number): Promise<boolean>; | ||
|
||
/** | ||
* Blocks until the provided timestamp is reached or a lock is acquired. | ||
* | ||
* @returns `true` if the lock was acquired, `false` otherwise. | ||
*/ | ||
tryLockSharedUntil(timestamp: number): Promise<boolean>; | ||
} |