6 /* Simple test program, has two races. A happens-before detector can only
7 ever detect one of them, though. XXX: apparently not so; Drd and H 3.4 detect both. */
9 int unprot1
= 0, unprot2
= 0, prot
= 0;
10 pthread_mutex_t mu
= PTHREAD_MUTEX_INITIALIZER
;
12 void* child_fn ( void* arg
)
15 pthread_mutex_lock( &mu
);
17 pthread_mutex_unlock( &mu
);
26 if (pthread_create(&child
, NULL
, child_fn
, NULL
)) {
27 perror("pthread_create");
32 pthread_mutex_lock( &mu
);
34 pthread_mutex_unlock( &mu
);
37 if (pthread_join(child
, NULL
)) {
38 perror("pthread join");