take a read lock that will be released when the function has finished running

  • Type Parameters

    • T

    Parameters

    • func: () => Promise<T>
    • timeout: null | number = null

      time in ms to wait to get the lock. Null mean infinite.

    Returns Promise<T>