Mercurial > sdl-ios-xcode
comparison src/thread/pthread/SDL_syssem.c @ 1851:536b0704b7d8
Make sure sem_wait didn't return early with EINTR. Fixes Bugzilla #231.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Wed, 17 May 2006 23:42:48 +0000 |
parents | eba962f9d603 |
children | c121d94672cb a1b03ba2fcd0 |
comparison
equal
deleted
inserted
replaced
1850:d5d3a6fe05a1 | 1851:536b0704b7d8 |
---|---|
21 */ | 21 */ |
22 #include "SDL_config.h" | 22 #include "SDL_config.h" |
23 | 23 |
24 #include <pthread.h> | 24 #include <pthread.h> |
25 #include <semaphore.h> | 25 #include <semaphore.h> |
26 #include <errno.h> | |
26 | 27 |
27 #include "SDL_thread.h" | 28 #include "SDL_thread.h" |
28 #include "SDL_timer.h" | 29 #include "SDL_timer.h" |
29 | 30 |
30 /* Wrapper around POSIX 1003.1b semaphores */ | 31 /* Wrapper around POSIX 1003.1b semaphores */ |
84 if ( ! sem ) { | 85 if ( ! sem ) { |
85 SDL_SetError("Passed a NULL semaphore"); | 86 SDL_SetError("Passed a NULL semaphore"); |
86 return -1; | 87 return -1; |
87 } | 88 } |
88 | 89 |
89 retval = sem_wait(&sem->sem); | 90 while ( ((retval = sem_wait(&sem->sem)) == -1) && (errno == EINTR) ) {} |
90 if ( retval < 0 ) { | 91 if ( retval < 0 ) { |
91 SDL_SetError("sem_wait() failed"); | 92 SDL_SetError("sem_wait() failed"); |
92 } | 93 } |
93 return retval; | 94 return retval; |
94 } | 95 } |