[zeromq-dev] Thread Safe sockets

Martin Sustrik sustrik at 250bpm.com
Mon Feb 6 21:45:13 CET 2012

Hi Nadav,

> I like the concept of having thread-safe sockets, but it seems that this
> implementation does not really deliver what a user would expect from a
> thread-safe socket. For instance, if two threads try to
> receive simultaneously from the same socket, each of them might obtain
> different frames that belong to one multipart message. Similarly,
> sending messages simultaneously from different threads over the same
> socket will get the individual frames intertwined.

That's a pretty good argument. The only question is whether it's an 
argument against thread-safe sockets or an arguments against multi-part 
messages :)

What makes the problem bad is the fact that there may be arbitrary 
interval between sending/receiving 1st and 2nd part of the message. 
During that time the socket has to be locked which in turn means that 
all other threads accessing it will be blocked for the period (1 hour, 
for example).


More information about the zeromq-dev mailing list