CoreDX DDS C++ Reference Manual
Public Member Functions | List of all members

A WaitSet maintains a set of Condition objects and allows the application to wait until one or more of them have a trigger_value of TRUE. More...

Public Member Functions

ReturnCode_t attach_condition (Condition &a_condition)
 Adds the condition c to the WaitSet ws. More...
 
ReturnCode_t detach_condition (Condition &a_condition)
 Removes a condition c from WaitSet ws. More...
 
ReturnCode_t wait (ConditionSeq &active_conditions, const Duration_t &timeout)
 Causes the controlling thread to block until an attached condition is triggered or timeout elapses. More...
 
ReturnCode_t get_conditions (ConditionSeq &attached_conditions)
 Retrieves the current list of attached conditions. More...
 

Detailed Description

A WaitSet maintains a set of Condition objects and allows the application to wait until one or more of them have a trigger_value of TRUE.

Multiple conditions may be attached to a WaitSet. A WaitSet is created by a call to WaitSet__alloc(), and destroyed with a call to WaitSet__free().

Member Function Documentation

ReturnCode_t DDS::WaitSet::attach_condition ( Condition a_condition)

Adds the condition c to the WaitSet ws.

If another thread is currently 'waiting' on the WaitSet, this newly added condition will unblock that thread if its trigger_value is TRUE.

ReturnCode_t DDS::WaitSet::detach_condition ( Condition a_condition)

Removes a condition c from WaitSet ws.

If the condition is not attached to the WaitSet, the error RETCODE_PRECONDITION_NOT_MET will be returned.

ReturnCode_t DDS::WaitSet::get_conditions ( ConditionSeq attached_conditions)

Retrieves the current list of attached conditions.

Populates the attached_conditions sequence. The application is responsible for freeing the memory contained in the sequence.

ReturnCode_t DDS::WaitSet::wait ( ConditionSeq active_conditions,
const Duration_t timeout 
)

Causes the controlling thread to block until an attached condition is triggered or timeout elapses.

A return value of RETCODE_OK indicates that one or more of the attached conditions evaluated to TRUE. Those 'active' conditions are included in the 'out' parameter active_conditions.

A return value of RETCODE_TIMEOUT indicates that the timeout period elapsed without any of the conditions evaluating to TRUE.

Note
The application is responsible for clearing the memory contained in active_conditions upon return.

© 2009-2017 Twin Oaks Computing, Inc
Castle Rock, CO 80108
All rights reserved.