epii-blocking-queue
Advanced tools
+2
-0
@@ -14,2 +14,3 @@ export type TaskItem = { | ||
| lockFinishNum: number; | ||
| _clearAlllock: boolean; | ||
| constructor(interval?: number); | ||
@@ -23,3 +24,4 @@ push(fun: Function): Promise<any>; | ||
| unlock(): void; | ||
| clearAllWaitLock(): void; | ||
| } | ||
| export declare function getBlockingQueue(name?: string): BlockingQueue; |
+7
-2
@@ -24,2 +24,3 @@ "use strict"; | ||
| this.lockFinishNum = 0; | ||
| this._clearAlllock = false; | ||
| (() => __awaiter(this, void 0, void 0, function* () { | ||
@@ -78,2 +79,3 @@ while (true) { | ||
| return __awaiter(this, void 0, void 0, function* () { | ||
| this._clearAlllock = false; | ||
| this.lockWaitNum++; | ||
@@ -86,5 +88,5 @@ let _forNum = this.lockWaitNum; | ||
| } | ||
| if (!this.enable) { | ||
| if (this._clearAlllock) { | ||
| this.unlock(); | ||
| throw new Error("thread is stoped"); | ||
| throw new Error("thread is clear"); | ||
| } | ||
@@ -99,2 +101,5 @@ yield sleep(100); | ||
| } | ||
| clearAllWaitLock() { | ||
| this._clearAlllock = true; | ||
| } | ||
| } | ||
@@ -101,0 +106,0 @@ exports.BlockingQueue = BlockingQueue; |
+1
-1
| { | ||
| "name": "epii-blocking-queue", | ||
| "version": "1.1.0", | ||
| "version": "1.1.1", | ||
| "description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
4455
4.82%135
5.47%