|
From: Julian S. <js...@ac...> - 2010-01-28 15:33:55
|
> Yeaaa.
> Still, I want a unit test were the current implementation hides a race.
> W/o a unittest, how do we test that the new implementation is correct (or
> at least better)?
Fair enough.
Something like this
4 threads, call them A1 A2 B1 and B2
1 barrier B of size 2
1 shared location L
All 4 threads created
B1 and B2 sleep(1)
A1 (or A2) writes to L
A1 and A2 do pthread_barrier_wait(B)
A1 and A2 sleep(1)
now B1 and B2 wake up. They do pthread_barrier_wait(B), thereby
falsely acquiring dependencies on A1 and A2's previous use of B
B1 (or B2) writes to L. This is really a race, but not detected due
to the false dependencies.
All 4 threads pth_join back to waiting parent.
Does that make sense? I think it should demonstrate the problem.
> There are two which are broken, I need to get rid of them.
> ANNOTATE_UNPUBLISH... is completely broken (bad idea)
> ANNOTATE_PUBLISH... is broken in case we are using literace-like sampling
I'll delete them in helgrind.h then.
J
|