From f86798dc006fe7d041c416fcc4bc9e5ba21fdfe8 Mon Sep 17 00:00:00 2001 From: Rodrigo Kumpera Date: Mon, 11 Apr 2011 15:08:39 -0300 Subject: [PATCH] Fix mono-tls usage under windows --- mono/utils/mono-threads.c | 6 +++++- mono/utils/mono-tls.h | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mono/utils/mono-threads.c b/mono/utils/mono-threads.c index 58d57c424f3..c94c818808c 100644 --- a/mono/utils/mono-threads.c +++ b/mono/utils/mono-threads.c @@ -178,7 +178,11 @@ mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size) gboolean res; threads_callbacks = *callbacks; thread_info_size = info_size; - res = mono_native_tls_alloc (&thread_info_key, unregister_thread); +#ifdef HOST_WIN32 + res = mono_native_tls_alloc (thread_info_key, NULL); +#else + res = mono_native_tls_alloc (thread_info_key, unregister_thread); +#endif mono_lls_init (&thread_list, free_thread_info); mono_thread_smr_init (); diff --git a/mono/utils/mono-tls.h b/mono/utils/mono-tls.h index 7e2ec1f1263..feba4180700 100644 --- a/mono/utils/mono-tls.h +++ b/mono/utils/mono-tls.h @@ -16,7 +16,7 @@ #include #define MonoNativeTlsKey DWORD -#define mono_native_tls_alloc(key,destructor) (g_assert (!destructor), (key = TlsAlloc ()) != TLS_OUT_OF_INDEXES) +#define mono_native_tls_alloc(key,destructor) ((key = TlsAlloc ()) != TLS_OUT_OF_INDEXES && destructor == NULL) #define mono_native_tls_set_value TlsSetValue #define mono_native_tls_get_value TlsGetValue @@ -25,7 +25,7 @@ #include #define MonoNativeTlsKey pthread_key_t -#define mono_native_tls_alloc(key,destructor) (pthread_key_create (key, destructor) == 0) +#define mono_native_tls_alloc(key,destructor) (pthread_key_create (&key, destructor) == 0) #define mono_native_tls_set_value pthread_setspecific #define mono_native_tls_get_value pthread_getspecific -- 2.11.4.GIT