0.5.0 • Published 3 years ago

@sz-md/mutex v0.5.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

@sz-md/mutex

const mutex = await Mutex.create(options)

const release = await mutex.acquire()

/* Critical section */

release()

Where options is an object:

{
	_maxQueueLength: 100 // maximum amount of waiters
}

A waiter is defined as:

The piece of code waiting for the Promise returned by acquire() to resolve.

API:

mutex.acquire()
mutex.tryAcquire() // returns release() function or NULL
mutex.isLocked() // returns true or false
0.5.0

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.1

3 years ago