15.8.8.1 Restricted Operations in Listener Callbacks

Based on the background and rules provided in 15.8.8 Exclusive Areas (EAs), this section describes how EAs restrict you from using various Connext APIs from within the Listener callbacks of different Entities. DataReader callbacks take the SubscriberEA. DataWriter callbacks take the PublisherEA. DomainParticipant callbacks take the ParticipantEA.

The following restrictions do not apply to builtin topic Listener callbacks.

Each Publisher and Subscriber creates and uses its own EA, and shares it with its children DataWriters and DataReaders, respectively.

An attempt to call a disallowed method from within a callback will result in RETCODE_ILLEGAL_OPERATION.

Within a DataWriter/DataReader’s Listener callback, do not:

  • Create any Entities
  • Delete any Entities
  • Enable any Entities
  • Set QoS on any Entities

Within a Subscriber/DataReader’s Listener callback, do not call any operations on:

  • Other Subscribers
  • DataReaders that belong to other Subscribers

Within a Publisher/DataWriter Listener callback, do not call any operations on:

  • Other Publishers
  • DataWriters that belong to other Publishers
  • Any Subscribers
  • Any DataReaders

Connext will enforce the rules to avoid deadlock, and any attempt to call an illegal method from within a Listener callback will return DDS_RETCODE_ILLEGAL_OPERATION.

The following operations are never allowed in any Listener callback, whether the callback is a builtin Entity's Listener callback or not:

  • Creation of a DomainParticipant.
  • Destruction of the entity to which the Listener is attached. For instance, a DataWriter/DataReader Listener callback must not destroy its DataWriter/DataReader.
  • Within the TopicListener callback, you cannot call any operations on DataReaders, DataWriters, Publishers, Subscribers, or DomainParticipants.
  • The DataWriterListener callback on_instance_replaced has further restrictions on the APIs that are allowed to be called because it can be called within the context of an in-progress write, dispose, or unregister call. Most APIs on the DataWriter must not be used in the on_instance_replaced callback. The only DataWriter APIs that are safe to call within this callback are:
    • FooDataWriter_get_key_value
    • FooDataWriter_narrow
    • FooDataWriter_as_datawriter
    • FooDataWriter_create_data
    • FooDataWriter_create_data_w_params
    • FooDataWriter_delete_data
    • FooDataWriter_delete_data_w_params
    • DataWriter_as_entity
    • DataWriter_get_matched_subscriptions
    • DataWriter_is_matched_subscription_active
    • DataWriter_get_matched_subscription_participant_data
    • DataWriter_get_topic
    • DataWriter_get_publisher
    • DataWriter_is_sample_app_acknowledged