Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

web-locks

metarhia39.6kMIT0.0.8

Web Locks API

web locks, lock, locks, locking, web-locks, parallel, parallel programming, concurrency, asynchronous, semaphore, mutex, nodejs, deadlock, data-race, race-detection, async-await, async, await, synchronize, synchronization, resource, thread, threads, multithreading, cas, atomics, spinlock, shared memory, worker threads, workers, sharedarraybuffer

readme

Web Locks API CI Status npm version npm downloads/month npm downloads license

Web Locks API implementation for Node.js based on worker_threads, Atomics, SharedArrayBuffer, asynchronous functions, and queue.

See specification: wicg.github.io/web-locks/ and documentation: developer.mozilla.org/en-US/docs/Web/API/Lock

This implementation is a part of Metarhia technology stack, needed for the first pilot project of Node.js application server based on parallel programming and workload micro-isolation. Web Locks API is intended to be merged into Node.js in future.

Features

  • Simplest parallel programming primitive to solve a problem of data races and race conditions.
  • Node.js and worker_threads support.
  • Different optimized implementations for certain cases: single-threaded asynchronous locks, multi-threaded locks with a single unifyed API.

Installation

$ npm install web-locks

Usage

await locks.request('Resource name', async lock => {
  // use named resource and release it after return
});

License

This implementation of Web Locks API is MIT licensed.