|
tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications
« « « Anklang Documentation |
A counting semaphore that spins on a atomic before waiting so will avoid system calls if wait periods are very short. More...
#include "tracktion_Semaphore.h"
Public Member Functions | |
| LightweightSemaphore (int initialCount=0) | |
| Creates a semaphore with an initial count. | |
| ~LightweightSemaphore () | |
| Destructor. | |
| bool | wait () |
| Decrements the count by one and if the result of this goes below zero the call will block. | |
| bool | try_wait () |
| Attemps to decrement the count by one. | |
| bool | timed_wait (std::uint64_t usecs) |
| Performs a wait operation. | |
| void | signal (int count=1) |
| Increases the count by the ammount specified. | |
A counting semaphore that spins on a atomic before waiting so will avoid system calls if wait periods are very short.
Definition at line 79 of file tracktion_Semaphore.h.
| tracktion::graph::LightweightSemaphore::LightweightSemaphore | ( | int | initialCount = 0 | ) |
Creates a semaphore with an initial count.
Definition at line 53 of file tracktion_Semaphore.cpp.
| tracktion::graph::LightweightSemaphore::~LightweightSemaphore | ( | ) |
Destructor.
Definition at line 58 of file tracktion_Semaphore.cpp.
| void tracktion::graph::LightweightSemaphore::signal | ( | int | count = 1 | ) |
Increases the count by the ammount specified.
If the count goes above zero, this will signal waiting threads, unblocking them.
Definition at line 77 of file tracktion_Semaphore.cpp.
| bool tracktion::graph::LightweightSemaphore::timed_wait | ( | std::uint64_t | usecs | ) |
Performs a wait operation.
If the wait would actually block, the block happens for the given period of time before returning or the semaphore is signalled, whichever happens first.
Definition at line 72 of file tracktion_Semaphore.cpp.
| bool tracktion::graph::LightweightSemaphore::try_wait | ( | ) |
Attemps to decrement the count by one.
If the decrement leaves the count above zero this will return true. If the decrement would leave the count below zero this will not block and return false.
Definition at line 67 of file tracktion_Semaphore.cpp.
| bool tracktion::graph::LightweightSemaphore::wait | ( | ) |
Decrements the count by one and if the result of this goes below zero the call will block.
Definition at line 62 of file tracktion_Semaphore.cpp.