JSPM

@zingle/mutex

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q23319F
  • License MIT

functions to create mutexes for objects or values

Package Exports

  • @zingle/mutex

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@zingle/mutex) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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