aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/helpers.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-08-28 17:21:01 -0700
committerChris Robinson <[email protected]>2011-08-28 17:21:01 -0700
commit5eceb593e9cfd57611e99217e2f9c346bb10305c (patch)
treee24bef2ea66470eabd8c8f2dfe19c8e38e7dc45a /Alc/helpers.c
parent82244f298ced5fd96dec5ee64c8a5b957b7dfdb4 (diff)
Emulate pthread TLS functions in Windows
Diffstat (limited to 'Alc/helpers.c')
-rw-r--r--Alc/helpers.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/Alc/helpers.c b/Alc/helpers.c
index 43ab43b9..85433368 100644
--- a/Alc/helpers.c
+++ b/Alc/helpers.c
@@ -59,6 +59,32 @@ void pthread_once(pthread_once_t *once, void (*callback)(void))
InterlockedExchange(once, 2);
}
+
+int pthread_key_create(pthread_key_t *key, void (*callback)(void*))
+{
+ *key = TlsAlloc();
+ if(callback)
+ InsertUIntMapEntry(&TlsDestructor, *key, callback);
+ return 0;
+}
+
+int pthread_key_delete(pthread_key_t key)
+{
+ InsertUIntMapEntry(&TlsDestructor, key, NULL);
+ TlsFree(key);
+ return 0;
+}
+
+void *pthread_getspecific(pthread_key_t key)
+{ return TlsGetValue(key); }
+
+int pthread_setspecific(pthread_key_t key, void *val)
+{
+ TlsSetValue(key, val);
+ return 0;
+}
+
+
void *LoadLib(const char *name)
{ return LoadLibraryA(name); }
void CloseLib(void *handle)