21 #include "../../SDL_internal.h"
45 if (pthread_cond_init(&cond->
cond,
NULL) != 0) {
59 pthread_cond_destroy(&cond->
cond);
75 if (pthread_cond_signal(&cond->
cond) != 0) {
92 if (pthread_cond_broadcast(&cond->
cond) != 0) {
102 #ifndef HAVE_CLOCK_GETTIME
103 struct timeval delta;
105 struct timespec abstime;
108 return SDL_SetError(
"Passed a NULL condition variable");
111 #ifdef HAVE_CLOCK_GETTIME
112 clock_gettime(CLOCK_REALTIME, &abstime);
114 abstime.tv_nsec += (ms % 1000) * 1000000;
115 abstime.tv_sec += ms / 1000;
117 gettimeofday(&delta,
NULL);
119 abstime.tv_sec = delta.tv_sec + (ms / 1000);
120 abstime.tv_nsec = (delta.tv_usec + (ms % 1000) * 1000) * 1000;
122 if (abstime.tv_nsec > 1000000000) {
124 abstime.tv_nsec -= 1000000000;
151 return SDL_SetError(
"Passed a NULL condition variable");
152 }
else if (pthread_cond_wait(&cond->
cond, &
mutex->
id) != 0) {