summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/test/tsan/SharedLibs/load_shared_lib-so.cc3
-rw-r--r--compiler-rt/test/tsan/load_shared_lib.cc6
2 files changed, 8 insertions, 1 deletions
diff --git a/compiler-rt/test/tsan/SharedLibs/load_shared_lib-so.cc b/compiler-rt/test/tsan/SharedLibs/load_shared_lib-so.cc
index d05aa6a40d1..f449fe97a15 100644
--- a/compiler-rt/test/tsan/SharedLibs/load_shared_lib-so.cc
+++ b/compiler-rt/test/tsan/SharedLibs/load_shared_lib-so.cc
@@ -12,11 +12,14 @@
//===----------------------------------------------------------------------===//
#include <stddef.h>
+#include <unistd.h>
int GLOB_SHARED = 0;
extern "C"
void *write_from_so(void *unused) {
+ if (unused)
+ sleep(1);
GLOB_SHARED++;
return NULL;
}
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);
OpenPOWER on IntegriCloud