Mercurial > sdl-ios-xcode
diff src/timer/linux/SDL_systimer.c @ 415:104f32d04cd1
Fixed building with pthreads and the pth library
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 13 Jun 2002 21:36:25 +0000 |
parents | 71fe0b713085 |
children | b8d311d90021 |
line wrap: on
line diff
--- a/src/timer/linux/SDL_systimer.c Thu Jun 13 17:52:43 2002 +0000 +++ b/src/timer/linux/SDL_systimer.c Thu Jun 13 21:36:25 2002 +0000 @@ -41,6 +41,9 @@ #if _POSIX_THREAD_SYSCALL_SOFT #include <pthread.h> #endif +#ifdef ENABLE_PTH +#include <pth.h> +#endif #if defined(DISABLE_THREADS) || defined(FORK_HACK) #define USE_ITIMER @@ -142,6 +145,12 @@ void SDL_Delay (Uint32 ms) { +#ifdef ENABLE_PTH + pth_time_t tv; + tv.tv_sec = ms/1000; + tv.tv_usec = (ms%1000)*1000; + pth_nap(tv); +#else int was_error; #ifdef USE_NANOSLEEP @@ -189,6 +198,7 @@ was_error = select(0, NULL, NULL, NULL, &tv); #endif /* USE_NANOSLEEP */ } while ( was_error && (errno == EINTR) ); +#endif /* ENABLE_PTH */ } #ifdef USE_ITIMER