src/thread/pthread/SDL_syssem.c
changeset 6298 9110462bfc57
parent 6219 8e94af244f2c
child 6885 700f1b25f77f
equal deleted inserted replaced
6296:b42657486c0d 6298:9110462bfc57
   148     do {
   148     do {
   149         retval = sem_timedwait(&sem->sem, &ts_timeout);
   149         retval = sem_timedwait(&sem->sem, &ts_timeout);
   150     } while (retval < 0 && errno == EINTR);
   150     } while (retval < 0 && errno == EINTR);
   151 
   151 
   152     if (retval < 0) {
   152     if (retval < 0) {
   153         SDL_SetError("sem_timedwait() failed");
   153         if (errno == ETIMEDOUT) {
       
   154             retval = SDL_MUTEX_TIMEDOUT;
       
   155         } else {
       
   156             SDL_SetError(strerror(errno));
       
   157         }
   154     }
   158     }
   155 #else
   159 #else
   156     end = SDL_GetTicks() + timeout;
   160     end = SDL_GetTicks() + timeout;
   157     while ((retval = SDL_SemTryWait(sem)) == SDL_MUTEX_TIMEDOUT) {
   161     while ((retval = SDL_SemTryWait(sem)) == SDL_MUTEX_TIMEDOUT) {
   158         if ((SDL_GetTicks() - end) >= 0) {
   162         if ((SDL_GetTicks() - end) >= 0) {