@chickenjdk/byteutils
    Preparing search index...

    Function wrapForLockIfNeeded

    • Wrap a callback for waiting for the lock, if isAsync is true. Otherwise this is a pass-though. Only wrap the code that needs the lock in this, to allow others to use the lock.

      Type Parameters

      • T

      Parameters

      • isAsync: boolean

        If the lock should be enabled.

      • lock: LockQueue | undefined

        The lock. Only should be provided if isAsync is true

      • cb: () => T

        The callback to call once the lock is acquired, or immediately if isAsync is false.

      Returns T

      The result of the callback.