On Friday 22 March 2013 14:54:09 Will Deng wrote: > Hi, > > In our application, we use bit fields a lot. For example: > > class data { > unsigned int the_thread_1_data:1; > unsigned int the_thread_2_data:3; > ... > }; > > When one thread is writing to the_thread_1_data, and another thread is > reading or writing to the_thread_2_data, helgrind will flag racing > condition. Is this a known issue in helgrind? Is there a way to get around > this? I believe the operation is multithread safe.
The C++11 standard says this is only safe if you insert unsigned int separator:0; between the two lines, in order to make these separate memory locations. I have no idea how compilers are supposed to implement this though. Maybe like gcc's __sync_fetch_and_{or|and} which is an atomic operation... Anyway -- this requires a (compliant) C++11-enabled compiler. -- David Faure, fa...@kde.org, http://www.davidfaure.fr Working on KDE, in particular KDE Frameworks 5 ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users