Class Semaphore
A Semaphore implementation.
A semaphore manages an internal counter which is decremented by each
acquire() call and incremented by each release()
call. The counter can never go below zero; when acquire() finds
that it is zero, it blocks, waiting until some other thread calls release().
The optional argument gives the initial value for the internal counter; it defaults to 1.
This class is not thread safe.
Inherits from
-
Object(base class)
Properties
| Name | Type | Description |
|---|---|---|
locked
[get]
|
bool |
Returns true if semaphore can not be acquired immediately. |
Methods
| Name | Description |
|---|---|
acquire
|
Acquire a semaphore. |
release
|
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. |
Authors
Dragos Carp
Copyright
© 2015-2016 Dragos Carp
License
Boost Software License - Version 1.0