aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-04-17 21:39:51 -0700
committerChris Robinson <[email protected]>2014-04-17 21:39:51 -0700
commit6c8bf9ec42b74635e05241a769f70ea5572a335c (patch)
tree462829a2c824adb0a6cd5de39f539c6cb16fbfec /OpenAL32/Include
parent20e5ec18e1e28b83ecaa588b87973be2cf295e74 (diff)
Rename althread_once to be more C11-like
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r--OpenAL32/Include/threads.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/OpenAL32/Include/threads.h b/OpenAL32/Include/threads.h
index eade2406..afeaeb4b 100644
--- a/OpenAL32/Include/threads.h
+++ b/OpenAL32/Include/threads.h
@@ -29,9 +29,6 @@ typedef void (*altss_dtor_t)(void*);
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-typedef DWORD althrd_t;
-typedef CRITICAL_SECTION almtx_t;
-typedef DWORD altss_t;
#ifndef __MINGW32__
struct timespec {
@@ -40,8 +37,15 @@ struct timespec {
};
#endif
+typedef DWORD althrd_t;
+typedef CRITICAL_SECTION almtx_t;
+typedef DWORD altss_t;
+typedef LONG alonce_flag;
+
+#define AL_ONCE_INIT 0
int althrd_sleep(const struct timespec *ts, struct timespec *rem);
+void alcall_once(alonce_flag *once, void (*callback)(void));
inline althrd_t althrd_current(void)
@@ -109,6 +113,9 @@ inline int altss_set(altss_t tss_id, void *val)
typedef pthread_t althrd_t;
typedef pthread_mutex_t almtx_t;
typedef pthread_key_t altss_t;
+typedef pthread_once_t alonce_flag;
+
+#define AL_ONCE_INIT PTHREAD_ONCE_INIT
inline althrd_t althrd_current(void)
@@ -190,6 +197,12 @@ inline int altss_set(altss_t tss_id, void *val)
return althrd_success;
}
+
+inline void alcall_once(alonce_flag *once, void (*callback)(void))
+{
+ pthread_once(once, callback);
+}
+
#endif