diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2014-03-18 06:37:31 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2014-03-18 06:37:31 +0000 |
commit | eac8cc7a42c5469a9af154b10f0fc19e57744656 (patch) | |
tree | 81563119153debe0eb2484c1a0bd5b89219d8b4b /compiler-rt/test/tsan/load_shared_lib.cc | |
parent | 7a1ac3b89b03d9a5ad557f287449facd59e86694 (diff) | |
download | bcm5719-llvm-eac8cc7a42c5469a9af154b10f0fc19e57744656.tar.gz bcm5719-llvm-eac8cc7a42c5469a9af154b10f0fc19e57744656.zip |
tsan: fix flaky test
llvm-svn: 204119
Diffstat (limited to 'compiler-rt/test/tsan/load_shared_lib.cc')
-rw-r--r-- | compiler-rt/test/tsan/load_shared_lib.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler-rt/test/tsan/load_shared_lib.cc b/compiler-rt/test/tsan/load_shared_lib.cc index d60cd5700a8..5b6b72b6edb 100644 --- a/compiler-rt/test/tsan/load_shared_lib.cc +++ b/compiler-rt/test/tsan/load_shared_lib.cc @@ -9,19 +9,23 @@ #include <dlfcn.h> #include <pthread.h> #include <stdio.h> +#include <stddef.h> +#include <unistd.h> #include <string> int GLOB = 0; void *write_glob(void *unused) { + if (unused) + sleep(1); GLOB++; return NULL; } void race_two_threads(void *(*access_callback)(void *unused)) { pthread_t t1, t2; - pthread_create(&t1, NULL, access_callback, NULL); + pthread_create(&t1, NULL, access_callback, (void*)1); pthread_create(&t2, NULL, access_callback, NULL); pthread_join(t1, NULL); pthread_join(t2, NULL); |