2 * mono-tls.h: Low-level TLS support
5 * Rodrigo Kumpera (kumpera@gmail.com)
10 #ifndef __MONO_TLS_H__
11 #define __MONO_TLS_H__
18 #define MonoNativeTlsKey DWORD
19 #define mono_native_tls_alloc(key,destructor) ((*(key) = TlsAlloc ()) != TLS_OUT_OF_INDEXES && destructor == NULL)
20 #define mono_native_tls_free TlsFree
21 #define mono_native_tls_set_value TlsSetValue
22 #define mono_native_tls_get_value TlsGetValue
28 #define MonoNativeTlsKey pthread_key_t
29 #define mono_native_tls_get_value pthread_getspecific
32 mono_native_tls_alloc (MonoNativeTlsKey *key, void *destructor)
34 return pthread_key_create (key, destructor) == 0;
38 mono_native_tls_free (MonoNativeTlsKey key)
40 pthread_key_delete (key);
44 mono_native_tls_set_value (MonoNativeTlsKey key, gpointer value)
46 return !pthread_setspecific (key, value);
49 #endif /* HOST_WIN32 */
52 #endif /* __MONO_TLS_H__ */