Skip to content

Commit

Permalink
Add ownsLock / ownsSharedLock properties
Browse files Browse the repository at this point in the history
  • Loading branch information
havelessbemore committed May 10, 2024
1 parent 03166e7 commit 30e42fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/types/basicLockable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
*/
export interface BasicLockable {
/**
* Blocks until a lock can be acquired for the current agent.
* Indicates whether the current agent owns the lock.
*/
ownsLock: readonly boolean;

/**
* Blocks until the lock can be acquired for the current agent.
* If an exception is thrown, no lock is acquired.
*/
lock(): Promise<void>;
Expand Down
5 changes: 5 additions & 0 deletions src/types/sharedLockable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
* Provides shared blocking semantics for agents (i.e. main thread, workers).
*/
export interface SharedLockable {
/**
* Indicates whether the current agent owns a shared lock.
*/
ownsSharedLock: readonly boolean;

/**
* Blocks until a shared lock can be acquired for the current
* agent. If an exception is thrown, no lock is acquired.
Expand Down

0 comments on commit 30e42fb

Please sign in to comment.