|
From: Leif W. <lei...@gm...> - 2012-12-04 13:22:38
|
Sent from my iPhone On Dec 4, 2012, at 4:49, Julian Seward <js...@ac...> wrote: > On Monday, December 03, 2012, Leif Walsh wrote: >> I have a memory location whose behavior I'd like to verify with helgrind >> and/or drd, but which I access in a racy way sometimes. I would like to >> ignore the race I know about but still have it checked for other accesses. >> Is this possible? >> >> The race is that, while a thread has a read lock, it may set the value to >> 1, but it does not read the value. While a thread has a write lock, it may >> read the value and it may set the value to 0. The race is that many >> threads can set it to 1 if they all have the read lock. DRD and helgrind >> tend to view this as a race. > > Correctly, IMO. Why do you think this behaviour is OK ? If you have > a read lock, you can read the location, but not write it. It is a race, but one that has the same result as if everything were serialized. If three threads all set this bit to 1, that's ok. It's ok because they're all trying to write the same thing. You're right, it is correctly flagged as a race, I'm just hoping to ask it to not report this one. > > Were you trying to achieve some larger goal, such as (at a guess) the > thread with the write lock creates a description of some work to be done > (in an object in memory) and multiple threads with read locks compete to > do that work, and write into the location you mentioned, in order to show > that they have completed it? > > J |