1 // RUN: %clangxx_tsan -O1 %s -DBUILD_SO -fPIC -shared -o %t-so.so
2 // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
5 // https://bugs.chromium.org/p/v8/issues/detail?id=4995
11 pthread_key_t keys_
[N
];
12 for (size_t i
= 0; i
< N
; ++i
) {
13 int err
= pthread_key_create(&keys_
[i
], 0);
15 fprintf(stderr
, "pthread_key_create failed with %d\n", err
);
19 for (size_t i
= 0; i
< N
; i
++)
20 pthread_setspecific(keys_
[i
], (void*)(long)i
);
21 for (size_t i
= 0; i
< N
; i
++)
22 pthread_key_delete(keys_
[i
]);
27 for (int i
= 0; i
< 10; i
++) {
29 pthread_create(&th
, 0, thr
, 0);
33 pthread_create(&th
[0], 0, thr
, 0);
34 pthread_create(&th
[1], 0, thr
, 0);
35 pthread_join(th
[0], 0);
36 pthread_join(th
[1], 0);
37 fprintf(stderr
, "DONE\n");