UNPKG

rsxjs

Version:

Resilience Extensions for JS.

20 lines (19 loc) 629 B
/** * @file src/mutex/index.ts * @copyright 2018-present Karim Alibhai. All rights reserved. */ import { MutexOptions } from './types'; import { Lock, ReleaseLock } from '../types'; export declare class Mutex extends Lock { private readonly name; private readonly failFast; private readonly timeout?; private readonly store; constructor(options?: Partial<MutexOptions>); _tryLock(): Promise<ReleaseLock | void>; /** * Lock the mutex. * @returns {Promise<ReleaseLock>} resolves when mutex is available with a function that can release the mutex */ lock(): Promise<ReleaseLock>; }