[zeromq-dev] Thread Safe sockets

john skaller skaller at users.sourceforge.net
Fri Feb 3 17:44:43 CET 2012

On 04/02/2012, at 3:19 AM, Chuck Remes wrote:

> On Feb 3, 2012, at 10:05 AM, john skaller wrote:
>>> A mutex works fine with a 0mq socket so adding one to the socket itself would also work. I just don't think it would perform well plus everyone would have to pay that price even if they didn't need it. Yuck.
>> I have implemented (but not tested) thread safe sockets, available in Pull request.
> You're lucky that the lack of tests isn't a problem for merging to master.

Heck no! Its a "bug" in ZMQ that there aren't extensive regression tests.
That "F" system has hundreds of tests.

I am working on a test harness which will allow testing multi-process test
cases, which are needed for 0MQ: eg a client and server as separate 
processes. Without that, automated testing is impossible.

The first cut of this code is written, but it crashes sporadically and at present
I'm trying to find out why. Yes its probably a bug in that "F" system :)

> We'll let the community decide. In my role as a maintainer, I have no opinion on patches. :)

In your role as Chuck I'm sure you do :)

I'd be interested in any performance comparisons. The patch is sure to slow 0MQ
down (for people not using the feature) but I have no idea how much. I have no particular
need for this patch myself. I also don't have any serious code base to test it against.
I don't mind if the patch is reverted (though the reorganisation of the C API should
be preserved, i.e. the first commit). However without it no one can experiment
so its hard to get any real experience to make a judgement. It only took a couple
of hours.

john skaller
skaller at users.sourceforge.net

More information about the zeromq-dev mailing list