Free or 'V' operation.
If there are any promises returned by {@link take()} still awaiting their fulfillment, exactly of them is fulfilled. The order of fulfillment is implementation-defined.
Take or 'P' operation.
A promise which is fulfilled when >= 1 of the resource represented by the internal counter is available. This might be the case either if free is called or if the semaphore is initialized with a value > 0.
Take ('P') if a resource is still available (<=> counter >= 1). Otherwise, do not block (as take does) and return false.
True if a resource could be taken, False otherwise.
Try taking ('P') a resource within the next millis
milliseconds.
A promise fulfilling with true
if a resource could be taken or
false
otherwise.
Generated using TypeDoc
General counting semaphore implementation.
Not thread-safe! Not safe with regard to pre-emptive multitasking (e.g. possible with some native code Node.js extensions).