Function dds_waitset_attach

Function Documentation

dds_return_t dds_waitset_attach(dds_entity_t waitset, dds_entity_t entity, dds_attach_t x)

This operation attaches an Entity to the WaitSet.

This operation attaches an Entity to the WaitSet. The dds_waitset_wait() will block when none of the attached entities are triggered. ‘Triggered’ (dds_triggered()) doesn’t mean the same for every entity:

  • Reader/Writer/Publisher/Subscriber/Topic/Participant

    • These are triggered when their status changed.

  • WaitSet

    • Triggered when trigger value was set to true by the application. It stays triggered until application sets the trigger value to false (dds_waitset_set_trigger()). This can be used to wake up an waitset for different reasons (f.i. termination) than the ‘normal’ status change (like new data).

  • ReadCondition/QueryCondition

    • Triggered when data is available on the related Reader that matches the Condition.

Multiple entities can be attached to a single waitset. A particular entity can be attached to multiple waitsets. However, a particular entity can not be attached to a particular waitset multiple times.

Parameters
  • waitset[in] The waitset to attach the given entity to.

  • entity[in] The entity to attach.

  • x[in] Blob that will be supplied when the waitset wait is triggerd by the given entity.

Return values
  • DDS_RETCODE_OK – Entity attached.

  • DDS_RETCODE_ERROR – An internal error has occurred.

  • DDS_RETCODE_BAD_PARAMETER – The given waitset or entity are not valid.

  • DDS_RETCODE_ILLEGAL_OPERATION – The operation is invoked on an inappropriate object.

  • DDS_RETCODE_ALREADY_DELETED – The waitset has already been deleted.

  • DDS_RETCODE_PRECONDITION_NOT_MET – The entity was already attached.

Returns

A dds_return_t indicating success or failure.