1.1.1 • Published 5 years ago

@seangenabe/mutex v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Mutex

Simple async-await mutex.

Usage

import { Mutex } from '@seangenabe/mutex'

const mutex = new Mutex()

;(async () => {
  const release = await mutex.wait()
  // ...
  release()
})()

mutex.wait(): Promise<() => void>

Returns: Promise<() => void>

Waits for other claims on this mutex, then resolves with a function that can be called to release the claim on this mutex.