diff options
author | Chris Robinson <[email protected]> | 2011-09-20 14:36:42 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-09-20 14:43:53 -0700 |
commit | e01092a0da3559a8c8c28312388ef9b416319aae (patch) | |
tree | f1409665bd4b968dff91baec7c7dabcf1109c2b4 /OpenAL32/Include/alMain.h | |
parent | 312e9a436da35fcb66839e0873d67c2e8f0aa3b7 (diff) |
Move Sleep implementation into helper.c and emulate sched_yield for Windows
Diffstat (limited to 'OpenAL32/Include/alMain.h')
-rw-r--r-- | OpenAL32/Include/alMain.h | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 719354f2..558f620b 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -183,6 +183,9 @@ typedef LONG pthread_once_t; #define PTHREAD_ONCE_INIT 0 void pthread_once(pthread_once_t *once, void (*callback)(void)); +static __inline int sched_yield(void) +{ SwitchToThread(); return 0; } + #else #include <unistd.h> @@ -204,16 +207,7 @@ void EnterCriticalSection(CRITICAL_SECTION *cs); void LeaveCriticalSection(CRITICAL_SECTION *cs); ALuint timeGetTime(void); - -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; -} +void Sleep(ALuint t); #if defined(HAVE_DLFCN_H) #define HAVE_DYNLOAD 1 |