Socket
Socket
Sign inDemoInstall

async-mutex

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-mutex - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

.travis.yml

2

package.json
{
"name": "async-mutex",
"version": "0.1.0",
"version": "0.1.1",
"description": "A mutex for guarding async workflows",

@@ -5,0 +5,0 @@ "scripts": {

@@ -0,1 +1,4 @@

[![Build Status](https://travis-ci.org/DirtyHairy/async-mutex.svg?branch=master)](https://travis-ci.org/DirtyHairy/async-mutex)
[![npm version](https://badge.fury.io/js/async-mutex.svg)](https://badge.fury.io/js/async-mutex)
# What is it?

@@ -71,13 +74,15 @@

mutex.acquire(function(release) {
// ...
});
mutex
.acquire()
.then(function(release) {
// ...
});
`acquire` schedules the supplied callback to be executed once the mutex is unlocked.
The mutex is locked during execution. Once the callback has finished its work, it
calls `release()` in order to release the mutex.
`acquire` returns an (ES6) promise that will resolve as soon as the mutex is
available and ready to be accessed. The promise resolves with a function `release` that
must be called once the mutex should be released again.
**IMPORTANT:** `acquire` will not take care of any exceptions throws during execution
of the callback --- it is your own responsibility to make sure that the mutex is
released in case of an exception.
**IMPORTANT:** Failure to call `release` will hold the mutex locked and will
lilely deadlock the application. Make sure to call `release` under all circumstances
and handle exceptions accordingly.

@@ -84,0 +89,0 @@ ### Synchronized code execution

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc