comparison src/thread/linux/SDL_syscond.c @ 244:dc660aee7d7d

Fixed timeout in Linux condition variable implementation
author Sam Lantinga <slouken@libsdl.org>
date Fri, 23 Nov 2001 17:11:05 +0000
parents 74212992fb08
children e8157fcb3114
comparison
equal deleted inserted replaced
243:cf4944faad96 244:dc660aee7d7d
135 } 135 }
136 136
137 gettimeofday(&delta, NULL); 137 gettimeofday(&delta, NULL);
138 138
139 abstime.tv_sec = delta.tv_sec + (ms/1000); 139 abstime.tv_sec = delta.tv_sec + (ms/1000);
140 abstime.tv_nsec = (delta.tv_usec+(ms%1000)) * 1000; 140 abstime.tv_nsec = (delta.tv_usec + (ms%1000) * 1000) * 1000;
141 if ( abstime.tv_nsec > 1000000 ) { 141 if ( abstime.tv_nsec > 1000000000 ) {
142 abstime.tv_sec += 1; 142 abstime.tv_sec += 1;
143 abstime.tv_nsec -= 1000000; 143 abstime.tv_nsec -= 1000000000;
144 } 144 }
145 145
146 tryagain: 146 tryagain:
147 retval = pthread_cond_timedwait(&cond->cond, &mutex->id, &abstime); 147 retval = pthread_cond_timedwait(&cond->cond, &mutex->id, &abstime);
148 switch (retval) { 148 switch (retval) {