Skip to content

Commit 743047f

Browse files
author
bart
committed
drd/tests/atomic_var: Revert r13876.
r13876 was a workaround for false ordering introduced by platform-specific (Solaris) code. The conclusion of an off-list discussion was that this has to be solved in the drd tool itself and not by modifying test programs. Hence this revert. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13980 a5019735-40e9-0310-863c-91ae7b9d1cf9
1 parent 96df3b4 commit 743047f

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

drd/tests/atomic_var.c

-6
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
has built-in functions for atomic memory access.
2424
#endif
2525

26-
static pthread_barrier_t s_barrier;
27-
2826
static __inline__
2927
int sync_add_and_fetch(int* p, int i)
3028
{
@@ -38,15 +36,13 @@ static int s_y = 0;
3836

3937
static void* thread_func_1(void* arg)
4038
{
41-
pthread_barrier_wait(&s_barrier);
4239
s_y = 1;
4340
(void) sync_add_and_fetch(&s_x, 1);
4441
return 0;
4542
}
4643

4744
static void* thread_func_2(void* arg)
4845
{
49-
pthread_barrier_wait(&s_barrier);
5046
while (sync_add_and_fetch(&s_x, 0) == 0)
5147
;
5248
fprintf(stderr, "y = %d\n", s_y);
@@ -60,12 +56,10 @@ int main(int argc, char** argv)
6056
pthread_t tid[n_threads];
6157

6258
fprintf(stderr, "Start of test.\n");
63-
pthread_barrier_init(&s_barrier, 0, 2);
6459
pthread_create(&tid[0], 0, thread_func_1, 0);
6560
pthread_create(&tid[1], 0, thread_func_2, 0);
6661
for (i = 0; i < n_threads; i++)
6762
pthread_join(tid[i], 0);
68-
pthread_barrier_destroy(&s_barrier);
6963
fprintf(stderr, "Test finished.\n");
7064

7165
return 0;

drd/tests/atomic_var.stderr.exp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Conflicting load by thread x at 0x........ size 4
44
at 0x........: thread_func_2 (atomic_var.c:?)
55
by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?)
66
Location 0x........ is 0 bytes inside global var "s_y"
7-
declared at atomic_var.c:37
7+
declared at atomic_var.c:35
88

99
y = 1
1010
Test finished.

drd/tests/atomic_var.vgtest

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
prereq: test -e atomic_var && ./supported_libpthread
2-
vgopts: --fair-sched=yes --read-var-info=yes --check-stack-var=yes --show-confl-seg=no --num-callers=2
2+
vgopts: --read-var-info=yes --check-stack-var=yes --show-confl-seg=no --num-callers=2
33
prog: atomic_var
44
stderr_filter: filter_stderr_and_thread_no

0 commit comments

Comments
 (0)