Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Semaphore

Semaphore

since

5.15.0

Hierarchy

Index

Constructors

Methods

Constructors

constructor

  • new Semaphore(count: number, defaultAcquireTimeout?: number): Semaphore
  • Parameters

    • count: number
    • defaultAcquireTimeout: number = -1

    Returns Semaphore

Methods

acquire

  • acquire(timeout?: number): Promise<ReleaseFunction>
  • Parameters

    • timeout: number = ...

    Returns Promise<ReleaseFunction>

use

  • use<T>(f: () => Promise<T>, timeout?: number): Promise<T>
  • Type parameters

    • T

    Parameters

    • f: () => Promise<T>
        • (): Promise<T>
        • Returns Promise<T>

    • timeout: number = ...

    Returns Promise<T>