@zingle/mutex

0.0.2 • Public • Published

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");
    }
}

Readme

Keywords

Package Sidebar

Install

npm i @zingle/mutex

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

4.08 kB

Total Files

6

Last publish

Collaborators

  • njovin
  • oleksandr.vladymyrov
  • rremer
  • lmedrano
  • llongo-medallia