mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-01-09 15:15:38 +00:00
On OS X, replace pthread_yield with sched_yield
This commit is contained in:
parent
d3f03a1fd3
commit
78ed5f5e92
|
@ -8,6 +8,10 @@
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <sched.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static void ReportErrorAndExit(int err, const char *msg) {
|
static void ReportErrorAndExit(int err, const char *msg) {
|
||||||
char errMsg[1024];
|
char errMsg[1024];
|
||||||
sprintf(errMsg, "Thread error -- %s: ", msg);
|
sprintf(errMsg, "Thread error -- %s: ", msg);
|
||||||
|
@ -77,7 +81,11 @@ void TCThread::Join() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TCThread::Yield() {
|
void TCThread::Yield() {
|
||||||
|
#ifdef __APPLE__
|
||||||
|
int result = sched_yield();
|
||||||
|
#else
|
||||||
int result = pthread_yield();
|
int result = pthread_yield();
|
||||||
|
#endif
|
||||||
if(result != 0) {
|
if(result != 0) {
|
||||||
ReportErrorAndExit(result, "pthread_yield");
|
ReportErrorAndExit(result, "pthread_yield");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue