diff options
author | Zoltan Varga <vargaz@gmail.com> | 2013-04-14 00:07:37 +0400 |
---|---|---|
committer | Zoltan Varga <vargaz@gmail.com> | 2013-04-14 00:07:37 +0400 |
commit | eff4cb5af8934b186574f2d7ebb1e2fae1b72351 (patch) | |
tree | 30c02cbeb26c0fcb8d875cf2a5e00361b9173f88 | |
parent | add213568839cd58105b3540e27036edf1954d7f (diff) |
Clear the domain on thread exit after the profile thread end hook, since it might need it to be set.mono-3.0.10
-rw-r--r-- | mono/metadata/threads.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c index b965ff2e484..e0ba2fde306 100644 --- a/mono/metadata/threads.c +++ b/mono/metadata/threads.c @@ -399,6 +399,15 @@ static void thread_cleanup (MonoInternalThread *thread) mono_profiler_thread_end (thread->tid); + if (thread == mono_thread_internal_current ()) { + /* + * This will signal async signal handlers that the thread has exited. + * The profiler callback needs this to be set, so it cannot be done earlier. + */ + mono_domain_unset (); + mono_memory_barrier (); + } + if (thread == mono_thread_internal_current ()) mono_thread_pop_appdomain_ref (); @@ -615,12 +624,6 @@ static guint32 WINAPI start_wrapper_internal(void *data) * for the current thead */ mono_thread_cleanup_apartment_state (); - /* - * This will signal async signal handlers that the thread has exited. - */ - mono_domain_unset (); - mono_memory_barrier (); - thread_cleanup (internal); /* Remove the reference to the thread object in the TLS data, |