Make sure sem_wait didn't return early with EINTR. Fixes Bugzilla #231.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401816
This commit is contained in:
Ryan C. Gordon 2006-05-17 23:42:48 +00:00
parent 90a334ec54
commit f60db1758a
3 changed files with 13 additions and 4 deletions

View file

@ -19,6 +19,9 @@
Sam Lantinga
slouken@libsdl.org
*/
#include <errno.h>
#include "SDL_config.h"
/* An implementation of semaphores using mutexes and condition variables */
@ -135,13 +138,15 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
int SDL_SemWait(SDL_sem *sem)
{
int retval;
if ( ! sem ) {
SDL_SetError("Passed a NULL semaphore");
return -1;
}
sem_wait(&sem->sem);
return 0;
while ( ((retval = sem_wait(&sem->sem)) == -1) && (errno == EINTR) ) {}
return retval;
}
Uint32 SDL_SemValue(SDL_sem *sem)