Unregistered instance not received

2 posts / 0 new
Last post
asanchez's picture
Offline
Last seen: 4 years 5 months ago
Joined: 11/16/2011
Posts: 50
Unregistered instance not received

Hi all,

I have an application with one DataWriter and one DataReader that catches when an instance is unregistered. It does the following:

- on the publisher side: After all the work is done, the only DataWriter calls unregister_instance() and exits (thus the DataWriter is deleted).

- on the subscriber side: a DataReaderListener checks for the sample's instance state to be DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE and then exits.

 However the state that I'm getting is DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE, as if the dipose() operation was invoked by the DataWriter as opose to unregister_instance(). Why a call to unregister_instance() provokes an instance to be disposed? is dispose() called implicitly by unregister_instance()?

Thanks,

Antonio

asanchez's picture
Offline
Last seen: 4 years 5 months ago
Joined: 11/16/2011
Posts: 50

Looking into the DataWriter's QoS policies I've noticed that the DDS_WriterDataLifecycleQosPolicy allows to control whether automatic dispose is sent by means of the autodispose_unregistered_instances field, and that by default is true. So I disabled the autodispose and I got  the expected DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE.

Seeing this, and reading the QoS related documentation, it looks like unregister_instance() will implicitliy dispose the instance. This behavior is not explained in the html documention for FooDataWriter_unregister_instance. Indeed, the function's documentation is even confusing because it remarks that such operation does not indicate that the instance is deleted (which is the purpose of dispose()) but however implicitly will dispose the instance. I think this part should be improved for a clearer description of the behavior.

Best

Antonio