Worker Sync

Latest Version Test codecov nodejs minimum version License: GPL v3

JavaScript synchronization functions (mutex, semaphore) between workers (and the main thread).

Setup

NodeJS

Released under both npmjs & github packages:

npmjs.com:@eyalsh/worker_sync github.com:@Eyal-Shalev/worker_sync

Install:

npm
npm install @eyalsh/worker_sync
yarn
yarn add @eyal-shalev/worker_sync

import (ES Modules):

import { Mutex, Semaphore } from "@eyalsh/worker_sync";

require (CommonJS):

const { Semaphore, Mutex } = require("@eyalsh/worker_sync");

Deno

The library is available to import from deno.land/x/worker_sync

import { Mutex, Semaphore } from "https://deno.land/x/worker_sync/mod.ts";

Browser - Download

You can download compiled library from GitHub:

import { Mutex, Semaphore } from "/path/to/worker_sync.esm.min.js";

Note: a bundled IIFE version also exist, if your application doesn't support ES modules.

<script src="/path/to/worker_sync.iife.min.js"></script>
<script>
  const {Semaphore, Mutex} = worker_sync;
</script>