Kanzi Connect  1.1.10
Kanzi Connect C++ API
kanzi::connect::Wait Class Reference

A class that allows to wait for specific condition to signal. More...

#include <wait.hpp>

Public Member Functions

ConnectConditionget ()
 Returns the signal variable that is used for waiting. More...
 
void interrupt ()
 Triggers the signal and breaks the wait. More...
 
void interruptAll ()
 Triggers the signal and breaks the wait for all subscibers. More...
 
 Wait (ConnectCondition *signal=0)
 Constructs a wait object, allows to pass a signal variable as a parameter. More...
 
bool wait (int64_t ms=-1)
 Starts waiting the signal to trigger, allows to specify a timeout for waiting. More...
 
 ~Wait ()
 Destructor. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Wait()

kanzi::connect::Wait::Wait ( ConnectCondition signal = 0)

Constructs a wait object, allows to pass a signal variable as a parameter.

Parameters
signalSignal to be used in waiting operation, a new one will be created if one is not given.

◆ ~Wait()

kanzi::connect::Wait::~Wait ( )

Destructor.

Member Function Documentation

◆ get()

ConnectCondition* kanzi::connect::Wait::get ( )

Returns the signal variable that is used for waiting.

Returns
The synchronization object that is used to perform waiting.

◆ interrupt()

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

◆ interruptAll()

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

◆ wait()

bool kanzi::connect::Wait::wait ( int64_t  ms = -1)

Starts waiting the signal to trigger, allows to specify a timeout for waiting.

Parameters
msTimeout in milliseconds, -1 for no timeout.
Returns
True if there was no timeout, false if timeout occurred.

The documentation for this class was generated from the following file: