Merge branch 'nunit25/2011-04-11' of https://github.com/DavidS/mono into DavidS-nunit...
[mono.git] / mono / utils / mono-tls.h
1 /*
2  * mono-tls.h: Low-level TLS support
3  *
4  * Author:
5  *      Rodrigo Kumpera (kumpera@gmail.com)
6  *
7  * (C) 2011 Novell, Inc
8  */
9
10 #ifndef __MONO_TLS_H__
11 #define __MONO_TLS_H__
12
13
14 #ifdef HOST_WIN32
15
16 #include <windows.h>
17
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_set_value TlsSetValue
21 #define mono_native_tls_get_value TlsGetValue
22
23 #else
24
25 #include <pthread.h>
26
27 #define MonoNativeTlsKey pthread_key_t
28 #define mono_native_tls_alloc(key,destructor) (pthread_key_create (&key, destructor) == 0) 
29 #define mono_native_tls_set_value pthread_setspecific
30 #define mono_native_tls_get_value pthread_getspecific
31
32 #endif /* HOST_WIN32 */
33
34
35 #endif /* __MONO_TLS_H__ */