[zeromq-dev] (no subject)
Martin Sustrik
sustrik at 250bpm.com
Thu Apr 21 22:49:40 CEST 2011
Ilja, Andrew,
std::string is able to make the reference counting trasparent to the
user using CoW semantics. Unfortunately, with zmq_msg_t we don't have
this option.
The place where the abstraction leaks most is zmq_msg_close() function.
It removes one reference from the BLOB (const operation) and if it
reaches zero, it deletes the BLOB (non-const operation).
The most sensible option seems to be to treat close as non-const
operation. The ugly part is the asymmetricity between zmq_msg_copy()
which adds a reference and zmq_msg_close() which removes a reference.
Former is const operation while later is non-const operation.
Another problem is getting a const data pointer from const message
object. C doesn't support polymorphism so something like this is not
possible:
void *zmq_msg_data (zmq_msg_t *msg);
const void *zmq_msg_data (const zmq_msg_t *msg);
Thoughts?
Martin
More information about the zeromq-dev
mailing list