[runtime] Move the test for shutting down the stat profiler to mini_cleanup ().
authorZoltan Varga <vargaz@gmail.com>
Sat, 2 Apr 2016 06:32:04 +0000 (02:32 -0400)
committerZoltan Varga <vargaz@gmail.com>
Sat, 2 Apr 2016 06:32:04 +0000 (02:32 -0400)
mono/mini/mini-posix.c
mono/mini/mini-runtime.c

index 932face077289a8f995a817f3f6fbf05c70d9bf4..6a9f99f9c5e09b4d8b36af246ad4d52ab878e145 100644 (file)
@@ -722,8 +722,7 @@ void
 mono_runtime_shutdown_stat_profiler (void)
 {
        InterlockedWrite (&sampling_thread_running, 0);
-       if (sampling_thread)
-               pthread_join (sampling_thread, NULL);
+       pthread_join (sampling_thread, NULL);
 
        /*
         * We can't safely remove the signal handler because we have no guarantee
index fdb1669c807f9f7defb1a6a9cc0fb88d51884bc0..f331f0c083556d2ac50db68b50ebf6139cdfd82f 100644 (file)
@@ -4164,7 +4164,8 @@ print_jit_stats (void)
 void
 mini_cleanup (MonoDomain *domain)
 {
-       mono_runtime_shutdown_stat_profiler ();
+       if (mono_profiler_get_events () & MONO_PROFILE_STATISTICAL)
+               mono_runtime_shutdown_stat_profiler ();
 
 #ifndef DISABLE_COM
        cominterop_release_all_rcws ();