diff options
author | Alexander Potapenko <glider@google.com> | 2014-07-21 13:01:06 +0000 |
---|---|---|
committer | Alexander Potapenko <glider@google.com> | 2014-07-21 13:01:06 +0000 |
commit | 2696f24aae24215b7a9e8b448a39d8d79d006d29 (patch) | |
tree | 3e7b6f41a5287f7ff7a6536450755833f2c917de | |
parent | e9471825794f3a8cb2c8fc06539fa863082590ac (diff) | |
download | compiler-rt-2696f24aae24215b7a9e8b448a39d8d79d006d29.tar.gz |
[lsan] Use a more standard-conformant sched_yield() instead of pthread_yield().
There's no pthread_yield() on OSX (only sched_yield() and pthread_yield_np()).
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@213516 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/lsan/TestCases/use_registers.cc | 5 | ||||
-rw-r--r-- | test/lsan/TestCases/use_stacks_threaded.cc | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/test/lsan/TestCases/use_registers.cc b/test/lsan/TestCases/use_registers.cc index d436144a8..ce11c3f77 100644 --- a/test/lsan/TestCases/use_registers.cc +++ b/test/lsan/TestCases/use_registers.cc @@ -7,6 +7,7 @@ #include <assert.h> #include <pthread.h> +#include <sched.h> #include <stdio.h> #include <stdlib.h> @@ -33,7 +34,7 @@ void *registers_thread_func(void *arg) { fflush(stderr); __sync_fetch_and_xor(sync, 1); while (true) - pthread_yield(); + sched_yield(); } int main() { @@ -42,7 +43,7 @@ int main() { int res = pthread_create(&thread_id, 0, registers_thread_func, &sync); assert(res == 0); while (!__sync_fetch_and_xor(&sync, 0)) - pthread_yield(); + sched_yield(); return 0; } // CHECK: Test alloc: [[ADDR:.*]]. diff --git a/test/lsan/TestCases/use_stacks_threaded.cc b/test/lsan/TestCases/use_stacks_threaded.cc index fc4e661c2..a1d4383e9 100644 --- a/test/lsan/TestCases/use_stacks_threaded.cc +++ b/test/lsan/TestCases/use_stacks_threaded.cc @@ -7,6 +7,7 @@ #include <assert.h> #include <pthread.h> +#include <sched.h> #include <stdio.h> #include <stdlib.h> @@ -18,7 +19,7 @@ void *stacks_thread_func(void *arg) { fflush(stderr); __sync_fetch_and_xor(sync, 1); while (true) - pthread_yield(); + sched_yield(); } int main() { @@ -27,7 +28,7 @@ int main() { int res = pthread_create(&thread_id, 0, stacks_thread_func, &sync); assert(res == 0); while (!__sync_fetch_and_xor(&sync, 0)) - pthread_yield(); + sched_yield(); return 0; } // CHECK: Test alloc: [[ADDR:.*]]. |