![]() |
Xyris
0.5
|
#include <Semaphore.hpp>
Collaboration diagram for Semaphore:Public Member Functions | |
| Semaphore (uint32_t val, bool share, const char *name=nullptr) | |
| bool | wait () |
| bool | tryWait () |
| bool | timeWait (const uint32_t *usec) |
| bool | post () |
| uint32_t | count () |
Private Attributes | |
| bool | m_isShared |
| uint32_t | m_count |
| struct task_sync | m_taskSync |
Definition at line 16 of file Semaphore.hpp.
| Semaphore::Semaphore | ( | uint32_t | val, |
| bool | share, | ||
| const char * | name = nullptr |
||
| ) |
Initializes a semaphore struct using the values defined. Semaphores are used in order to maintain mutual exclusion when multiple threads need to access a particular variable.
| val | Initial value |
| share | Allow semaphore to be shared across threads |
| name | Semaphore name (for debugging / printing) |
Definition at line 23 of file Semaphore.cpp.
| uint32_t Semaphore::count | ( | ) |
Atomically get the semaphore's current counter value.
Definition at line 81 of file Semaphore.cpp.
Here is the caller graph for this function:| bool Semaphore::post | ( | ) |
Post to the semaphore.
Definition at line 73 of file Semaphore.cpp.
Here is the call graph for this function:| bool Semaphore::timeWait | ( | const uint32_t * | usec | ) |
Wait on the semaphore for a set duration of time.
| usec | Microseconds to wait until returning if unsuccessful. |
Definition at line 58 of file Semaphore.cpp.
Here is the call graph for this function:| bool Semaphore::tryWait | ( | ) |
Check if the semaphore is available. If unavailable, return immediately, otherwise wait on the semaphore.
Definition at line 45 of file Semaphore.cpp.
Here is the call graph for this function:| bool Semaphore::wait | ( | ) |
Wait for the semaphore to become available.
Definition at line 31 of file Semaphore.cpp.
Here is the call graph for this function:
|
private |
Definition at line 68 of file Semaphore.hpp.
|
private |
Definition at line 67 of file Semaphore.hpp.
|
private |
Definition at line 69 of file Semaphore.hpp.