Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Kumpera <kumpera@gmail.com>2015-09-11 00:36:50 +0300
committerRodrigo Kumpera <kumpera@gmail.com>2015-09-11 00:37:55 +0300
commit19130f7816b84b7101676c7c8ecd2c1f62656052 (patch)
tree7a7669295c53f9054af2abd1aee8e21fb792caa0
parent4fd72b41e7efac38a87bb76c7668c6ec7b03da57 (diff)
[threading] Allow mono_thread_info_current_unchecked to be called before the tls key it uses is initialized.
-rw-r--r--mono/utils/mono-threads.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mono/utils/mono-threads.c b/mono/utils/mono-threads.c
index 366f09468e9..68ec25d84b9 100644
--- a/mono/utils/mono-threads.c
+++ b/mono/utils/mono-threads.c
@@ -422,7 +422,7 @@ mono_threads_unregister_current_thread (MonoThreadInfo *info)
MonoThreadInfo*
mono_thread_info_current_unchecked (void)
{
- return (MonoThreadInfo*)mono_native_tls_get_value (thread_info_key);
+ return thread_info_key ? (MonoThreadInfo*)mono_native_tls_get_value (thread_info_key) : NULL;
}
@@ -578,6 +578,9 @@ mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size)
res = mono_native_tls_alloc (&thread_info_key, (void *) unregister_thread);
res = mono_native_tls_alloc (&thread_exited_key, (void *) thread_exited_dtor);
#endif
+
+ g_assert (thread_info_key);
+
g_assert (res);
#ifndef HAVE_KW_THREAD