Hi Stephan, I was solving the same problem some time ago. The trick is to call the object "destructor" from the deallocator method. You can use e.g. std::shared_ptr with reference counting to relay the actual destruction when both your application and ZMQ are done with the "object". Note that the deallocator method has additional "hint" parameter, which you can use for this.
Best regards Radek On Thu, Aug 31, 2017 at 12:49 PM, Stephan Opfer <op...@vs.uni-kassel.de> wrote: > Hi Luca, > > thank you for your hints. I am currently stuck with a little problem, that > is probably related to your hin about cleaning up the messages to early. My > current state is uploaded on gist: https://gist.github.com/Stepha > nOpfer/98e32c13c822c33e06d56bc82956c7c2 > > The thing is, that the messages are transfered correctly, when my process > waits for some time, before it ends. So my question is, what do I don't > understand correctly here? > > My current impression, or explanation of this phenomenon, is that the > zmq_msg_send method is working asynchronously and the process ended, before > zmq can send everything correctly. > > If that is the case I am not sure, what the best way will be to manage the > data in my real application. How do I know, that zmq has finished sending > my data, so that it would be ok to delete it. If I would let zmq decide to > delete the data (by passing a deallocator method to zmq_msg_init_data), it > could happen that it deletes the data to early for other parts of my > application. > > Greetings, > Stephan > > -- > Distributed Systems Research Group > Stephan Opfer T. +49 561 804-6280 F. +49 561 804-6277 > Univ. Kassel, FB 16, Wilhelmshöher Allee 73, D-34121 Kassel > WWW: http://www.uni-kassel.de/go/vs_stephan-opfer/ > _______________________________________________ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > https://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________ zeromq-dev mailing list zeromq-dev@lists.zeromq.org https://lists.zeromq.org/mailman/listinfo/zeromq-dev