1 /* { dg-shouldfail "tsan" } */
10 void *Thread1(void *x
) {
12 pthread_mutex_lock(&mtx
);
14 pthread_mutex_unlock(&mtx
);
18 void *Thread2(void *x
) {
20 return NULL
;/* { dg-output ".*" } */
25 pthread_mutex_init(&mtx
, 0);
27 pthread_create(&t
[0], NULL
, Thread1
, NULL
);
28 pthread_create(&t
[1], NULL
, Thread2
, NULL
);
29 pthread_join(t
[0], NULL
);
30 pthread_join(t
[1], NULL
);
31 pthread_mutex_destroy(&mtx
);
35 /* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */
36 /* { dg-output " Read of size 4 at 0x\[0-9a-f\]+ by thread T1 \\(mutexes: write M\[0-9\]\\):.*" } */
37 /* { dg-output " Previous write of size 4 at 0x\[0-9a-f\]+ by thread T2:.*" } */
38 /* { dg-output " Mutex M\[0-9\] created at:.*" } */
39 /* { dg-output " #0 pthread_mutex_init.*" } */
40 /* { dg-output " #1 main (.*mutexset1.c|\\?{2}):\[0-9]+.*" } */