1 /* Test program for the annotations that suppress write operations. */
3 #include <assert.h> /* assert() */
6 #include <stdio.h> /* EOF */
7 #include <unistd.h> /* getopt() */
8 #include "../../drd/drd.h"
14 static void* thread_func(void* arg
)
16 /* Read s_a and modify s_b. */
24 int main(int argc
, char** argv
)
26 const struct timespec delay
= { 0, 100 * 1000 * 1000 };
31 while ((optchar
= getopt(argc
, argv
, "r")) != EOF
)
43 pthread_create(&tid
, 0, thread_func
, 0);
45 /* Let the code in the created thread run first. */
49 ANNOTATE_IGNORE_WRITES_BEGIN();
50 /* Read s_b and modify s_a. */
53 ANNOTATE_IGNORE_WRITES_END();
56 * Insert a delay here in order to make sure the load of s_c happens
57 * after s_c has been modified.
61 /* Read s_c and modify s_a. */
66 fprintf(stderr
, "Finished.\n");