EYHN
2024-03-22 16:43:26 +00:00
parent 05c44db5a9
commit 34703a3b7d
85 changed files with 3248 additions and 2286 deletions
@@ -0,0 +1,20 @@
export class AsyncLock {
private _lock = Promise.resolve();
async acquire() {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
let release: () => void = null!;
const nextLock = new Promise<void>(resolve => {
release = resolve;
});
await this._lock;
this._lock = nextLock;
return {
release,
[Symbol.dispose]: () => {
release();
},
};
}
}
+1
View File
@@ -1,3 +1,4 @@
export * from './async-lock';
export * from './async-queue';
export * from './merge-updates';
export * from './object-pool';