(Note: in the Modern C++ API, Entities are automatically destroyed, see Creating and Deleting DDS Entities)
This section applies to both implicitly and explicitly created Subscribers.
To delete a Subscriber:
DDS_ReturnCode_t delete_datareader (DDSDataReader *a_datareader)
Note: A Subscriber cannot be deleted within a listener callback, see Restricted Operations in Listener Callbacks.
The Subscriber’s delete_contained_entities() operation deletes all the DataReaders that were created by the Subscriber. It also deletes the ReadConditions created by each contained DataReader.
DDS_ReturnCode_t DDSSubscriber::delete_contained_entities ()
After this operation returns successfully, the application may delete the Subscriber (see Deleting Subscribers).
The operation will return PRECONDITION_NOT_MET if any of the contained entities cannot be deleted. This will occur, for example, if a contained DataReader cannot be deleted because the application has called read() but has not called the corresponding return_loan() operation to return the loaned DDS samples.
© 2018 RTI