lifecycle-utils
    Preparing search index...

    Function withSharedLock

    • Run a callback while holding a shared lock for the given scope.

      Multiple shared locks can run in parallel, while a regular lock requires exclusive access. Lock requests are acquired in the order they are made; consecutive shared lock requests acquired together. A new shared lock joins an active shared lock immediately when no regular lock requests are waiting.

      Type Parameters

      • ReturnType
      • const Scope extends readonly any[]

      Parameters

      Returns Promise<ReturnType>

    • Run a callback while holding a shared lock for the given scope.

      Multiple shared locks can run in parallel, while a regular lock requires exclusive access. Lock requests are acquired in the order they are made; consecutive shared lock requests acquired together. A new shared lock joins an active shared lock immediately when no regular lock requests are waiting.

      Type Parameters

      • ReturnType
      • const Scope extends readonly any[]

      Parameters

      Returns Promise<ReturnType>