[zeromq-dev] Inproc and zero-copy question

Lindley French lindleyf at gmail.com
Wed Feb 5 21:32:05 CET 2014

I'm trying to pass a set of pointers between threads using an inproc
socket. On the originating side, they're C++ shared_ptrs. I was thinking of
using an in-place-constructed std::weak_ptr as the message. In order for
this to make sense, I need the following guarantees:

1) Messages will not be moved around with C-style memcpy, etc. I don't know
how weak_ptr (or shared_ptr) would react to this, but it's a bad idea in
general. It can break vtables and stuff like that. I recall reading that
inproc doesn't do any copying, but is this an API guarantee or just an
implementation detail?
2) Messages will not be dropped silently. I think PAIR and PUSH/PULL meet
this requirement. Please confirm----there is NO WAY for these types to drop
messages, correct?

Passing smart pointers around as if they're raw bytes makes me very
nervous, but I think it can be done if it's handled with great care.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140205/496e489b/attachment.htm>

More information about the zeromq-dev mailing list