@zingle/mutex
v0.0.2
Published
functions to create mutexes for objects or values
Downloads
4
Readme
The mutex
function creates synchronization primitives for values or objects.
Usage
const mutex = require("@zingle/mutex");
function critical(resource) {
if (let release = mutex(resource)) {
// ...do critical things...
release();
} else {
throw new Error("could not acquire lock");
}
}