1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.TaskPool = void 0;
|
4 | const task_queue_1 = require("./task-queue");
|
5 | class TaskPool extends task_queue_1.TaskQueue {
|
6 | constructor(concurrentSize = 1) {
|
7 | super();
|
8 | this.concurrentSize = concurrentSize;
|
9 | this.ps = new Array(concurrentSize).fill('').map(() => new task_queue_1.TaskQueue());
|
10 | this.i = 0;
|
11 | }
|
12 | runTask(f) {
|
13 | this.i = (this.i + 1) % this.ps.length;
|
14 | return this.ps[this.i].runTask(f);
|
15 | }
|
16 | }
|
17 | exports.TaskPool = TaskPool;
|
18 |
|
\ | No newline at end of file |