UNPKG

664 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const tslib_1 = require("tslib");
4const lock_1 = require("../lock");
5class RunnerPool {
6 constructor(limit) {
7 this.lock = new lock_1.Lock(limit);
8 }
9 run(task) {
10 return tslib_1.__awaiter(this, void 0, void 0, function* () {
11 yield this.lock.acquire(1);
12 try {
13 return yield task();
14 }
15 catch (e) {
16 throw e;
17 }
18 finally {
19 this.lock.release(1);
20 }
21 });
22 }
23}
24exports.RunnerPool = RunnerPool;
25//# sourceMappingURL=runner-pool.js.map
\No newline at end of file