All of the documentation consistently warns you about doing a full-memory 
barrier (mutex, semaphore, etc) if you are going to use a socket in more than 
one thread. If you create it in one and pass it to another for operations, then 
you don't need to be too concerned about this.

So, to answer your question, NO, you don't need a full-memory barrier for your 
simple example.

cr

On Oct 25, 2012, at 12:03 PM, Kah-Chan Low wrote:

> Hi,
> If I create a ZMQ socket, do not touch it direct or indirectly after this, 
> and spawn a thread and hand over the pointer of socket to the new thread.
> The new thread is the only thread that perform operations on the socket, 
> including deleting the socket.
> Is this the right way to migrate the socket across 2 threads?
> zmq_socket reference manual talks about using "full fence" memory barrier to 
> do this.
> Do I really need to do this for my simple example?
> 
> Thanks!
> kc
> 
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to