@ac-essentials/misc-util
    Preparing search index...

    Interface ILockable

    Interface representing a lockable resource.

    A lockable resource can be acquired and released to ensure exclusive access.

    interface ILockable {
        locked: boolean;
        acquire(signal?: null | AbortSignal): Promisable<Callable>;
        release(): Promisable<void>;
        withLock<R>(
            func: MaybeAsyncCallableNoArgs<R>,
            signal?: null | AbortSignal,
        ): Promisable<R>;
    }

    Implemented by

    Index

    Properties

    Methods

    Properties

    locked: boolean

    Indicates whether the lock is currently held.

    Methods

    • Acquires the lock, waiting if necessary until it is available.

      Parameters

      • Optionalsignal: null | AbortSignal

        An optional AbortSignal to cancel the acquire operation.

      Returns Promisable<Callable>

      A promise that resolves to a function that releases the lock.