SampleCursor code cleanup & couple of more fixes

This commit is contained in:
Vanilagy
2025-12-18 20:51:44 +01:00
parent 75af91f7b7
commit de82f6f3c9
4 changed files with 764 additions and 674 deletions
+18
View File
@@ -1024,6 +1024,24 @@ export class CallSerializer2 {
}
}
export class AsyncGate {
resolvers: (() => void)[] = [];
wait() {
const { promise, resolve } = promiseWithResolvers();
this.resolvers.push(resolve);
return promise;
}
open() {
if (this.resolvers.length > 0) {
this.resolvers.forEach(fn => fn());
this.resolvers.length = 0;
}
}
}
export const defer = (callback: () => void) => {
let executed = false;