|
From: Ivo R. <iv...@iv...> - 2016-06-10 04:49:26
|
2016-06-09 15:24 GMT+02:00 Kirill Frolov <kir...@de...>: > Hello, All! > > How can I annotate source code (see below) to stop valgrind's DRD > tool complain about data race? > > I think this source doesn't contain any data race, but DRD thinks > otherwise. This is because common synchronization primitives (like > mutexes) not used in this case. The code relies on possibility of CPU > to swap 's' pointer atomically. > > You need to help DRD in such cases because as you said you are not using common synchronization primitives. The question is also why? I was not able to discern your intention but it seems to me you are introducing a barrier or a producer-consumer queue. There are efficient POSIX synchronization primitives for these tasks which DRD supports natively. Otherwise use DRD client requests [1] to annotate your intent. Kind regards, I. [1] http://valgrind.org/docs/manual/drd-manual.html#drd-manual.clientreqs |