class used to protect shared data from being simultaneously accessed by multiple process via a shared memory.
More...
#include <semaphore.hpp>
|
| | SharedSemaphore (size_t value=0) |
| | create instance.
|
| |
| | SharedSemaphore (const SharedSemaphore &other)=delete |
| | copy constructor.
|
| |
| SharedSemaphore & | operator= (const SharedSemaphore &other)=delete |
| | copy assignment operator.
|
| |
| | ~SharedSemaphore () noexcept |
| | destroy instance.
|
| |
| void | post () noexcept |
| | increments the internal counter and unblocks acquirers.
|
| |
| void | wait () noexcept |
| | decrements the internal counter or blocks until it can
|
| |
| bool | tryWait () noexcept |
| | tries to decrement the internal counter without blocking.
|
| |
| template<class Rep , class Period > |
| bool | timedWait (std::chrono::duration< Rep, Period > timeout) |
| | tries to decrement the internal counter, blocking for up to a duration time.
|
| |
| int | value () noexcept |
| | get semaphore value.
|
| |
class used to protect shared data from being simultaneously accessed by multiple process via a shared memory.
◆ SharedSemaphore() [1/2]
| SharedSemaphore::SharedSemaphore |
( |
size_t | value = 0 | ) |
|
create instance.
- Parameters
-
◆ SharedSemaphore() [2/2]
copy constructor.
- Parameters
-
| other | other object to copy. |
◆ ~SharedSemaphore()
| SharedSemaphore::~SharedSemaphore |
( |
| ) |
|
|
noexcept |
◆ operator=()
copy assignment operator.
- Parameters
-
| other | other object to assign. |
- Returns
- assigned object.
◆ post()
| void SharedSemaphore::post |
( |
| ) |
|
|
noexcept |
increments the internal counter and unblocks acquirers.
◆ timedWait()
template<class Rep , class Period >
| bool join::SharedSemaphore::timedWait |
( |
std::chrono::duration< Rep, Period > | timeout | ) |
|
|
inline |
tries to decrement the internal counter, blocking for up to a duration time.
- Parameters
-
- Returns
- true on success, false otherwise.
◆ tryWait()
| bool SharedSemaphore::tryWait |
( |
| ) |
|
|
noexcept |
tries to decrement the internal counter without blocking.
- Returns
- true on success, false otherwise.
◆ value()
| int SharedSemaphore::value |
( |
| ) |
|
|
noexcept |
get semaphore value.
- Returns
- -1 on error, semaphore value otherwise.
◆ wait()
| void SharedSemaphore::wait |
( |
| ) |
|
|
noexcept |
decrements the internal counter or blocks until it can
The documentation for this class was generated from the following files: