New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@matrixai/async-locks

Package Overview
Dependencies
Maintainers
4
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@matrixai/async-locks - npm Package Compare versions

Comparing version 2.3.0 to 2.3.1

3

dist/RWLockReader.d.ts

@@ -15,3 +15,2 @@ import type { MutexInterface } from 'async-mutex';

protected _writerCount: number;
protected activeLock: 'read' | 'write' | null;
lock(type: 'read' | 'write', timeout?: number): ResourceAcquire<RWLockReader>;

@@ -27,3 +26,3 @@ read(timeout?: number): ResourceAcquire<RWLockReader>;

*/
isLocked(type?: 'read' | 'write'): boolean;
isLocked(): boolean;
waitForUnlock(timeout?: number): Promise<void>;

@@ -30,0 +29,0 @@ withF<T>(...params: [

@@ -17,3 +17,2 @@ "use strict";

this._writerCount = 0;
this.activeLock = null;
}

@@ -62,7 +61,5 @@ lock(type, timeout) {

readersRelease();
this.activeLock = 'read';
}
else {
readersRelease();
this.activeLock = 'read';
// Yield for the first reader to finish locking

@@ -80,3 +77,2 @@ await (0, utils_1.yieldMicro)();

readersRelease();
this.activeLock = null;
// Allow semaphore to settle https://github.com/DirtyHairy/async-mutex/issues/54

@@ -104,3 +100,2 @@ await (0, utils_1.yieldMicro)();

}
this.activeLock = 'write';
return [

@@ -110,3 +105,2 @@ async () => {

--this._writerCount;
this.activeLock = null;
// Allow semaphore to settle https://github.com/DirtyHairy/async-mutex/issues/54

@@ -132,10 +126,4 @@ await (0, utils_1.yieldMicro)();

*/
isLocked(type) {
if (type != null) {
return (this.activeLock === type &&
(this.readersLock.isLocked() || this.writersLock.isLocked()));
}
else {
return this.readersLock.isLocked() || this.writersLock.isLocked();
}
isLocked() {
return this.readersLock.isLocked() || this.writersLock.isLocked();
}

@@ -142,0 +130,0 @@ async waitForUnlock(timeout) {

@@ -15,3 +15,2 @@ import type { MutexInterface } from 'async-mutex';

protected _writerCount: number;
protected activeLock: 'read' | 'write' | null;
lock(type: 'read' | 'write', timeout?: number): ResourceAcquire<RWLockWriter>;

@@ -18,0 +17,0 @@ read(timeout?: number): ResourceAcquire<RWLockWriter>;

@@ -18,3 +18,2 @@ "use strict";

this._writerCount = 0;
this.activeLock = null;
}

@@ -67,6 +66,4 @@ lock(type, timeout) {

}
this.activeLock = 'read';
}
else {
this.activeLock = 'read';
// Yield for the first reader to finish locking

@@ -81,3 +78,2 @@ await (0, utils_1.yieldMicro)();

this.readersRelease();
this.activeLock = null;
// Allow semaphore to settle https://github.com/DirtyHairy/async-mutex/issues/54

@@ -122,3 +118,2 @@ await (0, utils_1.yieldMicro)();

}
this.activeLock = 'write';
return [

@@ -129,3 +124,2 @@ async () => {

--this._writerCount;
this.activeLock = null;
// Allow semaphore to settle https://github.com/DirtyHairy/async-mutex/issues/54

@@ -152,6 +146,8 @@ await (0, utils_1.yieldMicro)();

isLocked(type) {
if (type != null) {
return (this.activeLock === type &&
(this.readersLock.isLocked() || this.writersLock.isLocked()));
if (type === 'read') {
return this.readersLock.isLocked();
}
else if (type === 'write') {
return this.writersLock.isLocked();
}
else {

@@ -158,0 +154,0 @@ return this.readersLock.isLocked() || this.writersLock.isLocked();

{
"name": "@matrixai/async-locks",
"version": "2.3.0",
"version": "2.3.1",
"author": "Roger Qiu",

@@ -5,0 +5,0 @@ "description": "Asynchronous locking utilities",

Sorry, the diff of this file is not supported yet

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