Replace pthread_yield with sched_yield.

The former is a non-standard glibc extension. On linux, it is implemented as a
call to sched_yield, so this change does nothing there. On OSX, pthread_yield
doesn't exist, and we already use sched_yield.
This commit is contained in:
iphydf 2016-09-02 09:51:11 +01:00
parent 579bdc126f
commit 6f42eadc54
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9

View File

@ -22,7 +22,6 @@
* -lopencv_highgui -lopencv_imgproc -lsndfile -pthread -lvpx -lopus -lsodium -lportaudio
*/
#include "../toxav/toxav.h"
#include "../toxcore/network.h" /* current_time_monotonic() */
#include "../toxcore/tox.h"
@ -40,6 +39,7 @@
#include <assert.h>
#include <errno.h>
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -47,13 +47,6 @@
#include <time.h>
#include <unistd.h>
#ifdef __APPLE__
#include <sched.h>
#define pthread_yield sched_yield
#else
#include <pthread.h>
#endif
#define c_sleep(x) usleep(1000*x)
@ -660,7 +653,7 @@ CHECK_ARG:
data.sig = -1;
while (data.sig != 1) {
pthread_yield();
sched_yield();
}
pthread_mutex_destroy(AliceCC.arb_mutex);
@ -765,7 +758,7 @@ CHECK_ARG:
data.sig = -1;
while (data.sig != 1) {
pthread_yield();
sched_yield();
}
printf("Success!");