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
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to