@hazae41/mutex
Advanced tools
Comparing version 2.0.3 to 2.1.0
@@ -29,22 +29,23 @@ import { Awaitable } from '../../libs/promises/promises.js'; | ||
get count(): number; | ||
get(): T; | ||
/** | ||
* Lock or throw an error | ||
* @param callback | ||
* Get and lock or throw | ||
* @returns | ||
*/ | ||
lockOrThrow<R>(callback: (inner: T) => Awaitable<R>): Promise<R>; | ||
getOrThrow(): Promise<Lock<T>>; | ||
/** | ||
* Lock or wait | ||
* @param callback | ||
* Get and lock or wait | ||
* @returns | ||
*/ | ||
lockOrWait<R>(callback: (inner: T) => Awaitable<R>): Promise<R>; | ||
getOrWait(): Promise<Lock<T>>; | ||
/** | ||
* Just wait | ||
* @returns | ||
* Run and lock or throw | ||
* @param callback | ||
*/ | ||
wait(): Promise<void>; | ||
runOrThrow<R>(callback: (inner: T) => Awaitable<R>): Promise<R>; | ||
/** | ||
* Lock and return a disposable object | ||
* @returns | ||
* Run and lock or wait | ||
* @param callback | ||
*/ | ||
acquire(): Promise<Lock<T>>; | ||
runOrWait<R>(callback: (inner: T) => Awaitable<R>): Promise<R>; | ||
} | ||
@@ -60,8 +61,9 @@ /** | ||
get locked(): boolean; | ||
lockOrThrow<R>(callback: (inner: T) => Awaitable<R>): Promise<R>; | ||
lockOrWait<R>(callback: (inner: T) => Awaitable<R>): Promise<R>; | ||
wait(): Promise<void>; | ||
acquire(): Promise<Lock<T>>; | ||
get(): T; | ||
getOrThrow(): Promise<Lock<T>>; | ||
getOrWait(): Promise<Lock<T>>; | ||
runOrThrow<R>(callback: (inner: T) => Awaitable<R>): Promise<R>; | ||
runOrWait<R>(callback: (inner: T) => Awaitable<R>): Promise<R>; | ||
} | ||
export { Lock, LockedError, Mutex, Semaphore }; |
{ | ||
"type": "module", | ||
"name": "@hazae41/mutex", | ||
"version": "2.0.3", | ||
"version": "2.1.0", | ||
"description": "Rust-like Mutex for TypeScript", | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/hazae41/mutex", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26252
381