[profiler] Start the helper thread before the writer thread.
authorAlex Rønne Petersen <alexrp@xamarin.com>
Sat, 8 Oct 2016 09:55:07 +0000 (11:55 +0200)
committerAlex Rønne Petersen <alexrp@xamarin.com>
Sat, 8 Oct 2016 09:55:31 +0000 (11:55 +0200)
This fixes a regression introduced in 0db428169a42373a73cd5c502bd40033629f3f8d
which caused the profiler to not report the correct command port in the file
header on startup.

mono/profiler/mono-profiler-log.c

index ae6c72067e047d2c9b0a727dbd65ff964c624b4d..67741d99d34f14bbf06ca8335ed7a63bc4b23908 100644 (file)
@@ -4471,9 +4471,6 @@ runtime_initialized (MonoProfiler *profiler)
 {
        InterlockedWrite (&runtime_inited, 1);
 
-       start_writer_thread (profiler);
-       start_dumper_thread (profiler);
-
        register_counter ("Sample events allocated", &sample_allocations_ctr);
        register_counter ("Log buffers allocated", &buffer_allocations_ctr);
 
@@ -4530,7 +4527,14 @@ runtime_initialized (MonoProfiler *profiler)
 
        counters_init (profiler);
 
+       /*
+        * We must start the helper thread before the writer thread. This is
+        * because the helper thread sets up the command port which is written to
+        * the log header by the writer thread.
+        */
        start_helper_thread (profiler);
+       start_writer_thread (profiler);
+       start_dumper_thread (profiler);
 }
 
 static MonoProfiler*