standalone-mutex
A standalone Mutex implementation for Nodejs which depends on Nodes inter-process communication
Installation
npm i standalone-mutex
Usage
Example
Below code can be found in example
directory
const cluster = ;const numCPUs = ;const Mutex = ;const log = consolelog; const MID = 'asdf65498'; // A unique id for indentifying our mutex. { return { ; };} { let mutex; return Mutex ;} { ; // Fork workers. for let i = 0; i < numCPUs; i++ cluster; Mutex; ; cluster;} { ; ;} if clusterisMaster ; else ;