RTI Connext C# API  7.1.0
WaitSet Class Reference

Allows an application to wait until one or more of the attached Condition objects have a trigger value of true or else until the timeout expires. More...

Inherits IDisposable.

Public Member Functions

 WaitSet ()
 Creates a new WaitSet More...
 
 WaitSet (WaitSetProperty property)
 Creates a new WaitSet with a non-default configuration. More...
 
void AttachCondition (Condition condition)
 Attaches a Condition to the WaitSet. More...
 
bool DetachCondition (Condition condition)
 Detaches a Condition from the WaitSet. More...
 
int Dispatch (Duration maxWait)
 Waits for at least one of the attached conditions to trigger and then calls the event handler for each of the active conditions. More...
 
int Dispatch ()
 Waits an unlimited amount of time for at least one of the attached conditions to trigger and then calls the event handlers of the active conditions. More...
 
IEnumerable< ConditionWait (Duration maxWait)
 Allows an application thread to wait for the occurrence of certain conditions. More...
 
IEnumerable< ConditionWait ()
 Allows an application thread to wait for the occurrence of certain conditions. It waits an infinite amount of time. More...
 
void Dispose ()
 Releases the native resources used by this WaitSet. A finalizer is also provided, so it is not necessary to call Dispose. More...
 

Properties

IEnumerable< ConditionConditions [get]
 Retrieves the list of attached Conditions. More...
 

Detailed Description

Allows an application to wait until one or more of the attached Condition objects have a trigger value of true or else until the timeout expires.

Constructor & Destructor Documentation

◆ WaitSet() [1/2]

WaitSet ( )

Creates a new WaitSet

The full documentation is available in the C API: DDS_WaitSet_new

◆ WaitSet() [2/2]

WaitSet ( WaitSetProperty  property)

Creates a new WaitSet with a non-default configuration.

The full documentation is available in the C API: DDS_WaitSet_new_ex

Member Function Documentation

◆ AttachCondition()

void AttachCondition ( Condition  condition)

Attaches a Condition to the WaitSet.

The full documentation is available in the C API: DDS_WaitSet_attach_condition

◆ DetachCondition()

bool DetachCondition ( Condition  condition)

Detaches a Condition from the WaitSet.

The full documentation is available in the C API: DDS_WaitSet_detach_condition

◆ Dispatch() [1/2]

int Dispatch ( )

Waits an unlimited amount of time for at least one of the attached conditions to trigger and then calls the event handlers of the active conditions.

Returns
The number of conditions that were triggered

◆ Dispatch() [2/2]

int Dispatch ( Duration  maxWait)

Waits for at least one of the attached conditions to trigger and then calls the event handler for each of the active conditions.

This is an alternative pattern to the use of Wait(). Instead of receiving the list of active conditions, the application associates an event handler to each condition before attaching it to the WaitSet. When this method wakes up after one or more conditions have become active, it calls their Condition.Triggered event handlers before returning. The handlers are called by Dispatch() in the context of the current thread.

Parameters
maxWaitThe maximum time to wait. If that time elapses this method returns normally without calling any of the condition handlers.
Returns
The number of conditions that were triggered (or 0 if the maxWait elapsed)

◆ Dispose()

void Dispose ( )

Releases the native resources used by this WaitSet. A finalizer is also provided, so it is not necessary to call Dispose.

◆ Wait() [1/2]

IEnumerable<Condition> Wait ( )

Allows an application thread to wait for the occurrence of certain conditions. It waits an infinite amount of time.

The full documentation is available in the C API: DDS_WaitSet_wait

◆ Wait() [2/2]

IEnumerable<Condition> Wait ( Duration  maxWait)

Allows an application thread to wait for the occurrence of certain conditions.

The full documentation is available in the C API: DDS_WaitSet_wait

Property Documentation

◆ Conditions

IEnumerable<Condition> Conditions
get

Retrieves the list of attached Conditions.

The full documentation is available in the C API: DDS_WaitSet_get_conditions