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:
-rw-r--r--mono/metadata/threads.c15
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,