Semaphore

Semaphore

A classic counting Semaphore used to regulate access to a resource.

Constructor

new Semaphore(valueopt)

Source:
See:
Parameters:
Name Type Attributes Default Description
value Number <optional>
1 The number of simultaneous acquisitions this semaphore will permit before blocking.

Classes

Semaphore

Methods

(async) acquire() → {Future.<boolean>}

Source:
Attempt to acquire one of the available slots in this semaphore. If none are available, wait in line until one is available.
Returns:
true
Type
Future.<boolean>

locked() → {boolean}

Source:
Has the semaphore exhausted all acquisitions.
Returns:
true if it will block an acquire
Type
boolean

release()

Source:
Release a slot previously acquired with acquire