Acquire a semaphore.
Release a semaphore, incrementing the internal counter by one. When it was zero on entry and another coroutine is waiting for it to become larger than zero again, wake up that coroutine.
Returns $(D_KEYWORD true) if semaphore can not be acquired immediately.
A Semaphore implementation.
A semaphore manages an internal counter which is decremented by each $(D_PSYMBOL acquire()) call and incremented by each $(D_PSYMBOL release()) call. The counter can never go below zero; when $(D_PSYMBOL acquire()) finds that it is zero, it blocks, waiting until some other thread calls $(D_PSYMBOL release()).
The optional argument gives the initial value for the internal counter; it defaults to 1.
This class is not thread safe.