[zeromq-dev] Whcih API calls are thread safe ?

Pieter Hintjens ph at imatix.com
Sun Jan 22 16:35:21 CET 2012


On Sun, Jan 22, 2012 at 8:57 AM, john skaller
<skaller at users.sourceforge.net> wrote:

>> I assume, that ALL socket oriented calls MUST be called from the thread,
>> which created the socket.
>
> That's not my understanding: the API notes say that a socket isn't thread safe,
> and a memory barrier must be used. Which implies it can be used on any thread
> provided you organise locking or whatever.

We removed all discussion of socket migration from the Guide after
finding that people would, over and over, read the first part, not
understand the memory barrier part, and then complain when their code
started crashing. So the Guide says, "don't do it, period". The man
page says "don't do it, but if you must, use a fmb".

-Pieter



More information about the zeromq-dev mailing list