|
From: Bart V. A. <bar...@gm...> - 2009-11-06 07:27:04
|
On Thu, Nov 5, 2009 at 11:38 PM, ERSEK Laszlo <la...@ca...> wrote: > On Thu, 5 Nov 2009, Bart Van Assche wrote: > >> Can you please post a small self-standing program or comment on >> Konstantin's test program >> (http://code.google.com/p/data-race-test/source/browse/trunk/unittest/racecheck_unittest.cc#520) >> ? I prefer commenting on a program that can be compiled and run instead >> of commenting on incomplete program fragments. > > Konstantin didn't get the false positives described in the manual. What I > proposed is only for the case when there's a false positive to avert, so > if there's no false positive then my proposition is automatically void. > > I installed valgrind-3.5.0 from source and wrote a small program: > > http://pastebin.com/f6a4181c2 Regarding the test program: the pointer-to-integer 'protected' is properly protected by locking, and the code that writes a value to *protected and the code that reads *protected is synchronized via the producer-consumer pattern. Helgrind and DRD will implicitly insert a happens-before arc between the producer and consumer, but ThreadSanitizer not. I believe that Konstantin proposed the ANNOTATE_PCQ_*() annotations some time ago in order to allow explicit annotation of the producer-consumer pattern in source code (see also http://article.gmane.org/gmane.comp.debugging.valgrind.devel/8398). P.S.: please use reply-all and don't modify the CC-list when replying. Bart. |