[zeromq-dev] best practices for messages over inproc

Pieter Hintjens pieterh at gmail.com
Fri Feb 18 15:01:40 CET 2011


Tom,

Sounds pretty good.

- Pieter Hintjens
On 18 Feb 2011 14:55, "Tom Wilberding" <tom at wilberding.com> wrote:
> Hi folks,
>
> I am using the C++ bindings and I'm developing an application that uses
> inproc sockets for actor model like message passing.
>
> I want to pass objects from thread to thread several times before
> finally serializing with google protocol buffers and pushing out via
> multicast.
>
> What is the best practice for passing around objects from thread to
> thread via in proc? I would rather not serialize/deserialize the entire
> object since I know I am using inproc?
>
> For example, assume I create an object in thread A, send it to thread B
> and then pass it along to thread C. Thread C then finally serializes the
> object and sends it on the wire.
>
> I assume I would instantiate an object in thread A and package a
> *pointer* to that object in a ZMQ message. That is, the binary payload
> of the message is just a pointer. After sending to thread B, thread A
> would be handling off responsibility for freeing the memory that the
> pointer refers to.
>
> Thread B would also pass the message containing a point to thread C and
> also would transfer responsibility for that memory to thread C.
>
> Finally thread C would serial the object and then would be responsible
> for deleting the object pointed to in the message.
>
> Do I have this correct? Any tips or gotchas from the group?
>
> Tom
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110218/41572291/attachment.htm>


More information about the zeromq-dev mailing list