On 06/09/14 08:51, Dave Ohlsson wrote:
> int i = 0;
> 
> int main()
> {
>     std::thread t1( []() { i = 1; } );
>     std::thread t2( []() { i = 2; } );
>     t1.join();
>     t2.join();
>     std::cerr << "i = " << i << std::endl;
>     return 0;
> }
> 
> [other code as before]
> </updated part of main.cc>
> 
> The problem now is that DRD does not warn about the data race.

Can you repeat this test with a sleep(1) inserted before "i = 1" ? This
false negative is maybe caused by std::thread using a shared pointer to
manage the created thread. Maybe that annotation informs DRD that i = 1
has finished before i = 2 is executed, hence the false negative.

Bart.


------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://www.hpccsystems.com
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to