aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include/threads.h
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32/Include/threads.h')
-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 */