[zeromq-dev] Thread Safe sockets

Chuck Remes cremes.devlist at mac.com
Fri Feb 3 17:52:23 CET 2012


On Feb 3, 2012, at 10:44 AM, john skaller wrote:

> 
> 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 :)

A test harness will be a very nice and very welcome addition to the project. I took a crack at it myself about 6 months ago but my C/C++ skills have eroded too far.


>> 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 :)

In my personal opinion, it sounds like an OK patch. If people don't use the new api call to allocate their context, they pay no penalty. Assuming that's the case, then I actually kind of like it.


> 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.

Kind of odd that you wrote the patch if you don't even need it. I think I'm back to confusion about your goals in this message thread regarding libzmq & Felix.

> I don't mind if the patch is reverted (though the reorganisation of the C API should
> be preserved, i.e. the first commit).

It may get reverted by someone else with an opinion.

> 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.

Agreed. Opinions are hard to form without data. Your patch gives us the opportunity to collect that data and make an informed decision.

cr




More information about the zeromq-dev mailing list