[zeromq-dev] [PATCH] Improved response to socket violations

Martin Sustrik sustrik at 250bpm.com
Fri May 20 18:58:12 CEST 2011

On 05/20/2011 06:22 PM, Marko Mikulicic wrote:

> What if the library could be compiled or parameterized with a "debug"
> flag/envvar, which enables thread identity checks and issue a warning
> if a socket is being used by two different threads at runtime? Then
> there will be a canned response for everybody reporting issues (please
> enabled debugging and try again),
> and still have a fast default path.

In theory, each socket could be wrapped in critical section, each call 
would pthread_mutex_trylock() and assert with nice descriptive error 
message if the mutex is already locked.

However, this doesn't work if one thread closes the socket and other 
thread tries to access it afterwards.


More information about the zeromq-dev mailing list