From 4789f63bf31e82c8137b1cdcd98949beadcf52df Mon Sep 17 00:00:00 2001 From: Alexander Potapenko Date: Mon, 21 Jul 2014 13:01:06 +0000 Subject: [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()). llvm-svn: 213516 --- compiler-rt/test/lsan/TestCases/use_registers.cc | 5 +++-- compiler-rt/test/lsan/TestCases/use_stacks_threaded.cc | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler-rt/test/lsan/TestCases/use_registers.cc b/compiler-rt/test/lsan/TestCases/use_registers.cc index d436144a8ef..ce11c3f77bc 100644 --- a/compiler-rt/test/lsan/TestCases/use_registers.cc +++ b/compiler-rt/test/lsan/TestCases/use_registers.cc @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -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/compiler-rt/test/lsan/TestCases/use_stacks_threaded.cc b/compiler-rt/test/lsan/TestCases/use_stacks_threaded.cc index fc4e661c261..a1d4383e956 100644 --- a/compiler-rt/test/lsan/TestCases/use_stacks_threaded.cc +++ b/compiler-rt/test/lsan/TestCases/use_stacks_threaded.cc @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -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:.*]]. -- cgit v1.2.3