[zeromq-dev] Is it safe to call zmq_msg_close() twice

Alexander Hill alexander.d.hill.89 at gmail.com
Sat May 16 04:22:31 CEST 2020

To answer the question in the subject, it is safe to close a closed
message--libzmq will notice that the message object is in an invalid
state and report EFAULT, doing no other work.

Sending a message, however, doesn't leave it in a closed state, but a
freshly-initialized one. Populating a cppzmq zmq::message_t, sending
it, and then letting the dtor run at the end of scope is completely

On Fri, May 15, 2020 at 4:12 AM Franz Hollerer <f.hollerer at gmx.net> wrote:
> Is it safe to call zmq_msg_close() twice for the same message?
> Rational: I use zmq.hpp. zmq_msg_close() is called within the destructor of zmq::message_t. But to my understanding it is also implicitly called when sending it. This results in a situation where zmq_msg_close() is called twice for the same message. Can this cause problems?
> Regards,
> Franz Hollerer
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev

More information about the zeromq-dev mailing list