Crashpad
|
An anonymous in-process counting sempahore. More...
#include "util/synchronization/semaphore.h"
Public Member Functions | |
Semaphore (int value) | |
Initializes the semaphore. More... | |
void | Wait () |
Performs the wait (or “procure”) operation on the semaphore. More... | |
bool | TimedWait (double seconds) |
Performs a timed wait (or “procure”) operation on the semaphore. More... | |
void | Signal () |
Performs the signal (or “post”) operation on the semaphore. More... | |
Static Public Attributes | |
static constexpr double | kIndefiniteWait |
A TimedWait() argument that causes an indefinite wait. More... | |
An anonymous in-process counting sempahore.
|
explicit |
Initializes the semaphore.
[in] | value | The initial value of the semaphore. |
If the semaphore cannot be created, execution is terminated.
void crashpad::Semaphore::Signal | ( | ) |
Performs the signal (or “post”) operation on the semaphore.
Atomically increments the value of the semaphore by 1. If the new value is 0, a caller blocked in Wait() will be awakened.
bool crashpad::Semaphore::TimedWait | ( | double | seconds | ) |
Performs a timed wait (or “procure”) operation on the semaphore.
[in] | seconds | The maximum number of seconds to wait for the operation to complete. If seconds is kIndefiniteWait, this method behaves as Wait(), and will not time out. |
false
if the wait timed out, true
otherwise.This method is simlar to Wait(), except that the amount of time that it blocks is limited.
void crashpad::Semaphore::Wait | ( | ) |
Performs the wait (or “procure”) operation on the semaphore.
Atomically decrements the value of the semaphore by 1. If the new value is negative, this function blocks and will not return until the semaphore’s value is incremented to 0 by Signal().
|
staticconstexpr |
A TimedWait() argument that causes an indefinite wait.