Comparing version 0.2.0 to 0.2.1
@@ -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 @@ |
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
16353
14
429
0
3