aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-04-16 06:59:44 -0700
committerChris Robinson <[email protected]>2014-04-16 06:59:44 -0700
commitb020dd13fda12ffa275f6c8165dcad481f9658d6 (patch)
tree8d9ab0e331765c305f62ab4cf609261913333b64 /OpenAL32/Include
parent184cf30cf70d0efcba8cfb7c27f464dbc4a3edaf (diff)
Avoid using a Sleep() wrapper
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r--OpenAL32/Include/threads.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/OpenAL32/Include/threads.h b/OpenAL32/Include/threads.h
index 84082604..b6a29f65 100644
--- a/OpenAL32/Include/threads.h
+++ b/OpenAL32/Include/threads.h
@@ -2,6 +2,7 @@
#define AL_THREADS_H
#include <time.h>
+#include <errno.h>
enum {
@@ -163,4 +164,15 @@ int almtx_timedlock(almtx_t *mtx, const struct timespec *ts);
void SetThreadName(const char *name);
+
+inline void al_nssleep(time_t sec, long nsec)
+{
+ struct timespec ts, rem;
+ ts.tv_sec = sec;
+ ts.tv_nsec = nsec;
+
+ while(althrd_sleep(&ts, &rem) == -1 && errno == EINTR)
+ ts = rem;
+}
+
#endif /* AL_THREADS_H */