Skip to content

jagi/mutex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@jagi/mutex

Simple TypeScript mutex implementation

Installation

npm install @jagi/mutex -S

or

yarn add @jagi/mutex

Usage

import Mutex from "@jagi/mutex";

const mutext = new Mutex();

const asyncActionResult = await mutex.run(async () => {
  // Running asynchronous action.
  return await asyncAction();
});

mutex.run(async () => {
  // This action will wait for the first one to finish.
  await anotherAsyncAction();
});

About

Simple TypeScript mutex implementation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published