/** * @license * Copyright 2022-2024 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ /** * A mutex is a task queue where at most one task is active at a time. */ export declare class Mutex implements PromiseLike { #private; constructor(owner: {}, initial?: PromiseLike); /** * As a PromiseLike, you can await the Mutex. This promise resolves when current activity completes but the mutex * may engage in another activity immediately thereafter. So the mutex is not guaranteed to be available after an * await. */ then(onfulfilled?: ((value: unknown) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; /** * Enqueue additional work. * * If {@link task} is a function it runs when current activity completes. If it is a promise then the mutex will * not clear until {@link task} resolves. */ run(task: PromiseLike | (() => PromiseLike), cancel?: () => void): void; /** * Cancel remaining work and perform one last task with the Mutex held. */ terminate(cleanup?: () => PromiseLike): void; /** * Execute a task immediately if it is a function. */ protected initiateTask(task: PromiseLike | (() => PromiseLike)): Promise; } //# sourceMappingURL=Mutex.d.ts.map