Correct conversion of COMPlus_EventPipeCircularMB value.
CoreClr detach/shutdown is flagged much later than Mono, meaning
Mono won't run function in ep_shutdown. Since EventPipe won't
out live runtime and already runs and shutdown as integrated part
of Mono shutdown, this will always be FALSE on Mono.
Thread sleep needs to enter/exit GC safe or it will block STW, delaying
operations like sample profiler and GC.
uint32_t circular_mb = 0;
gchar *value = g_getenv ("COMPlus_EventPipeCircularMB");
if (value)
- circular_mb = strtoul (value, NULL, 9);
+ circular_mb = strtoul (value, NULL, 10);
g_free (value);
return circular_mb;
}
bool
ep_rt_process_detach (void)
{
- return (mono_runtime_is_shutting_down () == TRUE) ? true : false;
+ // This is set to early in Mono compared to coreclr and only represent runtime
+ // shutting down. EventPipe won't be shutdown to late on Mono, so always return FALSE.
+ return FALSE;
}
static
void
ep_rt_thread_sleep (uint64_t ns)
{
- g_usleep (ns / 1000);
+ MONO_REQ_GC_UNSAFE_MODE;
+ if (ns == 0) {
+ mono_thread_info_yield ();
+ } else {
+ MONO_ENTER_GC_SAFE;
+ g_usleep (ns / 1000);
+ MONO_EXIT_GC_SAFE;
+ }
}
static