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
fine.

On Fri, May 15, 2020 at 4:12 AM Franz Hollerer <[email protected]> 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
> [email protected]
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________
zeromq-dev mailing list
[email protected]
https://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to