Wait¶
-
class
kanzi::connect
::
Wait
¶ 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.
Public Functions
-
Wait
(ConnectCondition *signal = 0)¶ Constructs a wait object, allows to pass a signal variable as a parameter.
- Parameters
signal – Signal to be used in waiting operation, a new one will be created if one is not given.
-
~Wait
()¶ Destructor.
-
ConnectCondition *
get
()¶ Returns the signal variable that is used for waiting.
- Returns
The synchronization object that is used to perform waiting.
-
void
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
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
wait
(int64_t ms = -1)¶ Starts waiting the signal to trigger, allows to specify a timeout for waiting.
- Parameters
ms – Timeout in milliseconds, -1 for no timeout.
- Returns
True if there was no timeout, false if timeout occurred.
-