MCPcopy Create free account
hub / github.com/Vanilagy/webcodecs-polyfill / lock

Method lock

src/misc.ts:368–379  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

366 private resolverQueue: (() => void)[] = [];
367
368 lock() {
369 if (!this.locked) {
370 // Fast path
371 this.locked = true;
372 return this.createLock(false, null);
373 }
374
375 const { promise, resolve } = promiseWithResolvers();
376 this.resolverQueue.push(resolve);
377
378 return this.createLock(true, promise);
379 }
380
381 private createLock(pending: boolean, ready: Promise<void> | null): AsyncMutexLock {
382 let released = false;

Callers 14

configureInternalMethod · 0.80
decodeInternalMethod · 0.80
flushInternalMethod · 0.80
configureInternalMethod · 0.80
encodeInternalMethod · 0.80
flushInternalMethod · 0.80
configureInternalMethod · 0.80
decodeInternalMethod · 0.80
flushInternalMethod · 0.80
configureInternalMethod · 0.80

Calls 2

createLockMethod · 0.95
promiseWithResolversFunction · 0.85

Tested by

no test coverage detected