UNPKG

@stryke/helpers

Version:

A package containing miscellaneous helper functions that are used across many different Storm Software projects.

20 lines (19 loc) 405 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Mutex = void 0; var _semaphore = require("./semaphore.cjs"); class Mutex { semaphore = new _semaphore.Semaphore(1); get isLocked() { return this.semaphore.available === 0; } async acquire() { return this.semaphore.acquire(); } release() { this.semaphore.release(); } } exports.Mutex = Mutex;