Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

locks

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

locks - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

test/readwritelock.js

6

CHANGELOG.md

@@ -0,1 +1,7 @@

# v0.2.1
* All callbacks now have the object as `this` value
* Added tests for ReadWriteLock
* Added coverage test (rpm run cover)
# v0.2.0

@@ -2,0 +8,0 @@

2

component.json

@@ -5,3 +5,3 @@ {

"description": "Mutex locks, Read/Write locks, Condition variables and Semaphores",
"version": "0.2.0",
"version": "0.2.1",
"scripts": [

@@ -8,0 +8,0 @@ "index.js",

@@ -14,3 +14,3 @@ function Mutex() {

this.isLocked = true;
cb();
cb.call(this);
}

@@ -23,3 +23,3 @@ };

this.isLocked = true;
return cb();
return cb.call(this);
}

@@ -37,3 +37,3 @@

cb();
cb.call(this);
cb = null;

@@ -44,3 +44,3 @@ });

if (cb) {
cb(new Error('Lock timed out'));
cb.call(this, new Error('Lock timed out'));
cb = null;

@@ -70,3 +70,3 @@ }

if (waiter) {
waiter();
waiter.call(this);
} else {

@@ -73,0 +73,0 @@ this.isLocked = false;

function ReadWriteLock() {
this.isLocked = null;
this.isLocked = false;
this._readLocks = 0;

@@ -17,3 +17,3 @@ this._waitingToRead = [];

this.isLocked = 'R';
cb();
cb.call(this);
}

@@ -28,3 +28,3 @@ };

this.isLocked = 'W';
cb();
cb.call(this);
}

@@ -36,3 +36,3 @@ };

if (this.tryReadLock()) {
return cb();
return cb.call(this);
}

@@ -50,3 +50,3 @@

cb();
cb.call(this);
cb = null;

@@ -57,3 +57,3 @@ });

if (cb) {
cb(new Error('ReadLock timed out'));
cb.call(this, new Error('ReadLock timed out'));
cb = null;

@@ -67,3 +67,3 @@ }

if (this.tryWriteLock()) {
return cb();
return cb.call(this);
}

@@ -81,3 +81,3 @@

cb();
cb.call(this);
cb = null;

@@ -88,3 +88,3 @@ });

if (cb) {
cb(new Error('WriteLock timed out'));
cb.call(this, new Error('WriteLock timed out'));
cb = null;

@@ -129,5 +129,5 @@ }

this.isLocked = 'W';
waiter();
waiter.call(this);
} else {
this.isLocked = null;
this.isLocked = false;
}

@@ -144,5 +144,5 @@ }

this.isLocked = 'W';
waiter();
waiter.call(this);
} else {
this.isLocked = null;
this.isLocked = false;
}

@@ -157,3 +157,3 @@ } else {

for (var i = 0; i < rlen; i++) {
waiters[i]();
waiters[i].call(this);
}

@@ -160,0 +160,0 @@ }

@@ -15,3 +15,3 @@ function Semaphore(initialCount) {

} else {
cb();
cb.call(this);
}

@@ -27,5 +27,5 @@ };

if (waiter) {
waiter();
waiter.call(this);
}
}
};
{
"name": "locks",
"version": "0.2.0",
"version": "0.2.1",
"description": "Mutex locks, Read/Write locks, Condition variables and Semaphores",

@@ -18,3 +18,4 @@ "keywords": [

"scripts": {
"test": "tape test/*.js | tap-spec"
"test": "tape test/*.js | tap-spec",
"cover": "rm -rf .nyc_output && nyc --silent --all tape test/*.js > /dev/null 2>&1 && nyc report"
},

@@ -25,2 +26,3 @@ "repository": "https://github.com/Wizcorp/locks",

"devDependencies": {
"nyc": "^3.2.2",
"tap-spec": "^4.1.0",

@@ -27,0 +29,0 @@ "tape": "^4.2.2"

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