From e1d0ad749bd5772d968aa8b5ed600dee905310a4 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 11 Jan 2008 08:15:44 -0800 Subject: Use nanosleep instead of usleep So not to rely on the non-standard unistd.h header --- OpenAL32/Include/alMain.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'OpenAL32/Include') diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 113101e4..c238a3a9 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -14,6 +14,8 @@ #include #include #include +#include +#include #define IsBadWritePtr(a,b) (0) @@ -68,7 +70,15 @@ static inline ALuint timeGetTime(void) return tv.tv_usec/1000 + tv.tv_sec*1000; } -#define Sleep(x) ((void)usleep((unsigned int)x*1000)) +static inline void Sleep(ALuint t) +{ + struct timespec tv, rem; + tv.tv_nsec = (t*1000000)%1000000000; + tv.tv_sec = t/1000; + + while(nanosleep(&tv, &rem) == -1 && errno == EINTR) + tv = rem; +} #define min(x,y) (((x)<(y))?(x):(y)) #define max(x,y) (((x)>(y))?(x):(y)) #endif -- cgit v1.2.3