Leif Walsh
2012-12-03 19:05:54 UTC
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.
I tried something like this, but wasn't surprised that it didn't work:
{
VALGRIND_HG_DISABLE_CHECKING(&var, sizeof var);
DRD_IGNORE_VAR(var);
var = 1;
DRD_STOP_IGNORING_VAR(var);
VALGRIND_HG_ENABLE_CHECKING(&var, sizeof var);
}
I can eliminate the race report if I disable checking on the variable
always, but I don't want to lose all that checking if I can avoid it.
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.
I tried something like this, but wasn't surprised that it didn't work:
{
VALGRIND_HG_DISABLE_CHECKING(&var, sizeof var);
DRD_IGNORE_VAR(var);
var = 1;
DRD_STOP_IGNORING_VAR(var);
VALGRIND_HG_ENABLE_CHECKING(&var, sizeof var);
}
I can eliminate the race report if I disable checking on the variable
always, but I don't want to lose all that checking if I can avoid it.
--
Cheers,
Leif
Cheers,
Leif