A class that allows to wait for specific condition to signal. More...
#include <wait.hpp>
Public Member Functions | |
ConnectCondition * | get () |
Returns the signal variable that is used for waiting. | |
void | interrupt () |
Triggers the signal and breaks the wait. | |
void | interruptAll () |
Triggers the signal and breaks the wait for all subscibers. | |
Wait (ConnectCondition *signal=0) | |
Constructs a wait object, allows to pass a signal variable as a parameter. | |
bool | wait (int64_t ms=-1) |
Starts waiting the signal to trigger, allows to specify a timeout for waiting. | |
~Wait () | |
Destructor. | |
A class that allows to wait for specific condition to signal.
Also supports timeout, in case user does not want to wait infinitely. Effectively implements a semaphore when using interrupt() method instead accessing the signal directly.
kanzi::connect::Wait::Wait | ( | ConnectCondition * | signal = 0 | ) |
Constructs a wait object, allows to pass a signal variable as a parameter.
signal | Signal to be used in waiting operation, a new one will be created if one is not given. |
kanzi::connect::Wait::~Wait | ( | ) |
Destructor.
ConnectCondition * kanzi::connect::Wait::get | ( | ) |
Returns the signal variable that is used for waiting.
void kanzi::connect::Wait::interrupt | ( | ) |
Triggers the signal and breaks the wait.
If this instance has not reached wait state, the next subsequent call for wait() will not enter wait, but allows the execution proceed
void kanzi::connect::Wait::interruptAll | ( | ) |
Triggers the signal and breaks the wait for all subscibers.
If this instance has not reached wait state, the next subsequent call for wait() will not enter wait, but allows the execution proceed
bool kanzi::connect::Wait::wait | ( | int64_t | ms = -1 | ) |
Starts waiting the signal to trigger, allows to specify a timeout for waiting.
ms | Timeout in milliseconds, -1 for no timeout. |