#include <semaphore.hpp>
A weak semaphore implementation.
- Note
- This uses a different naming scheme than the rest of this project because it is intended to have the same feel as the standard library.
-
This semaphore implementation is based on https://gist.github.com/sguzman/9594227
Definition at line 36 of file semaphore.hpp.
◆ semaphore() [1/3]
semaphore::semaphore |
( |
const semaphore & |
other | ) |
|
|
delete |
◆ semaphore() [2/3]
◆ semaphore() [3/3]
semaphore::semaphore |
( |
size_t |
initial_value = 0 | ) |
|
Construct a semaphore with the given initial value.
- Parameters
-
initial_value | The initial value of the semaphore. Defaults to 0. |
Definition at line 28 of file semaphore.cpp.
◆ notify()
void semaphore::notify |
( |
| ) |
|
Signal the semaphore.
Increments the semaphore.
Definition at line 38 of file semaphore.cpp.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ wait()
Wait on the semaphore.
Decrements the semaphore.
Definition at line 52 of file semaphore.cpp.
◆ wait_for()
template<class Rep , class Period >
bool semaphore::wait_for |
( |
const std::chrono::duration< Rep, Period > & |
rel_time | ) |
|
Wait on the semaphore, or a given duration timeout.
- Parameters
-
rel_time | The duration of the timeout. |
- Return values
-
true | The semaphore has been successfully decremented. |
false | The semaphore timed out. |
Definition at line 66 of file semaphore.hpp.
◆ wait_until()
template<class Clock , class Duration >
bool semaphore::wait_until |
( |
const std::chrono::time_point< Clock, Duration > & |
timeout_time | ) |
|
Wait on the semaphore, or a given timepoint timeout.
- Parameters
-
timeout_time | The timepoint for the timeout. |
- Return values
-
true | The semaphore has been successfully decremented. |
false | The semaphore timed out. |
Definition at line 90 of file semaphore.hpp.
The documentation for this class was generated from the following files: