Skip to content

gobansource/nano-mutex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nano-mutex

A lightweight TypeScript implementation of a mutex (mutual exclusion lock) for asynchronous JavaScript applications.

Installation

npm install nano-mutex

Usage

import { createMutex } from "nano-mutex";
// or import Mutex from 'nano-mutex';

async function example() {
  const mutex = createMutex();

  // Acquire the lock
  const release = await mutex.acquire();

  try {
    // Critical section - only one execution at a time
    await doSomethingAsync();
  } finally {
    // Always release the lock when done
    release();
  }
}

License

© Goban Source, LLC, 2025. Released under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published