[zeromq-dev] Whcih API calls are thread safe ?
Pieter Hintjens
ph at imatix.com
Sun Jan 22 15:40:35 CET 2012
On Sun, Jan 22, 2012 at 2:28 AM, Marten Feldtmann
<itlists at schrievkrom.de> wrote:
> I assume, that ALL socket oriented calls MUST be called from the thread,
> which created the socket. Is this also true with the API call to close
> the socket ?
Sockets are not threadsafe objects, so any API call that uses or
affects them must be done from the same thread. You can move a socket
from one thread to another but you have to do so explicitly, with a
full memory barrier. So you could in theory close sockets from a
different thread but with care to stop using them in the original
thread.
-Pieter
More information about the zeromq-dev
mailing list