diff options
author | Chris Robinson <[email protected]> | 2011-08-28 17:21:01 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-08-28 17:21:01 -0700 |
commit | 5eceb593e9cfd57611e99217e2f9c346bb10305c (patch) | |
tree | e24bef2ea66470eabd8c8f2dfe19c8e38e7dc45a /OpenAL32/Include/alMain.h | |
parent | 82244f298ced5fd96dec5ee64c8a5b957b7dfdb4 (diff) |
Emulate pthread TLS functions in Windows
Diffstat (limited to 'OpenAL32/Include/alMain.h')
-rw-r--r-- | OpenAL32/Include/alMain.h | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 0a006ee9..357090a6 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -160,6 +160,23 @@ typedef ptrdiff_t ALsizeiptrEXT; #define RESTRICT #endif + +typedef struct UIntMap { + struct { + ALuint key; + ALvoid *value; + } *array; + ALsizei size; + ALsizei maxsize; +} UIntMap; + +void InitUIntMap(UIntMap *map); +void ResetUIntMap(UIntMap *map); +ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value); +void RemoveUIntMapKey(UIntMap *map, ALuint key); +ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key); + + #ifdef _WIN32 #ifndef _WIN32_WINNT @@ -167,11 +184,13 @@ typedef ptrdiff_t ALsizeiptrEXT; #endif #include <windows.h> -typedef DWORD tls_type; -#define tls_create(x) (*(x) = TlsAlloc()) -#define tls_delete(x) TlsFree((x)) -#define tls_get(x) TlsGetValue((x)) -#define tls_set(x, a) TlsSetValue((x), (a)) +extern UIntMap TlsDestructor; + +typedef DWORD pthread_key_t; +int pthread_key_create(pthread_key_t *key, void (*callback)(void*)); +int pthread_key_delete(pthread_key_t key); +void *pthread_getspecific(pthread_key_t key); +int pthread_setspecific(pthread_key_t key, void *val); #define HAVE_DYNLOAD 1 void *LoadLib(const char *name); @@ -196,12 +215,6 @@ void pthread_once(pthread_once_t *once, void (*callback)(void)); #define IsBadWritePtr(a,b) ((a) == NULL && (b) != 0) -typedef pthread_key_t tls_type; -#define tls_create(x) pthread_key_create((x), NULL) -#define tls_delete(x) pthread_key_delete((x)) -#define tls_get(x) pthread_getspecific((x)) -#define tls_set(x, a) pthread_setspecific((x), (a)) - typedef pthread_mutex_t CRITICAL_SECTION; void InitializeCriticalSection(CRITICAL_SECTION *cs); void DeleteCriticalSection(CRITICAL_SECTION *cs); @@ -365,21 +378,6 @@ void alc_loopback_deinit(void); void alc_loopback_probe(enum DevProbe type); -typedef struct UIntMap { - struct { - ALuint key; - ALvoid *value; - } *array; - ALsizei size; - ALsizei maxsize; -} UIntMap; - -void InitUIntMap(UIntMap *map); -void ResetUIntMap(UIntMap *map); -ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value); -void RemoveUIntMapKey(UIntMap *map, ALuint key); -ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key); - /* Device formats */ enum DevFmtType { DevFmtByte = AL_BYTE, |