platform-bible-utils
    Preparing search index...

    Class Mutex

    Class that allows calling asynchronous functions multiple times at once while only running one at a time.

    const mutex = new Mutex();

    mutex.runExclusive(async () => {
    // Do some asynchronous stuff
    console.log('These run one-at-a-time');
    });

    mutex.runExclusive(async () => {
    // Do some asynchronous stuff
    console.log('These run one-at-a-time');
    });

    See async-mutex for more information.

    Hierarchy

    • Mutex
      • Mutex
    Index

    Constructors

    • Parameters

      • OptionalcancelError: Error

      Returns Mutex

    Methods

    • Parameters

      • Optionalpriority: number

      Returns Promise<Releaser>

    • Returns void

    • Returns boolean

    • Returns void

    • Type Parameters

      • T

      Parameters

      • callback: Worker<T>
      • Optionalpriority: number

      Returns Promise<T>

    • Parameters

      • Optionalpriority: number

      Returns Promise<void>