From 78ed5f5e9256628e23412255f64397544dfc2814 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Mon, 1 Oct 2012 13:01:20 -0400 Subject: [PATCH] On OS X, replace pthread_yield with sched_yield --- Core/src/ThreadPThread.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Core/src/ThreadPThread.cpp b/Core/src/ThreadPThread.cpp index 1569922..2564ab6 100644 --- a/Core/src/ThreadPThread.cpp +++ b/Core/src/ThreadPThread.cpp @@ -8,6 +8,10 @@ #include #include +#ifdef __APPLE__ +#include +#endif + static void ReportErrorAndExit(int err, const char *msg) { char errMsg[1024]; sprintf(errMsg, "Thread error -- %s: ", msg); @@ -77,7 +81,11 @@ void TCThread::Join() { } void TCThread::Yield() { +#ifdef __APPLE__ + int result = sched_yield(); +#else int result = pthread_yield(); +#endif if(result != 0) { ReportErrorAndExit(result, "pthread_yield"); }