#include "jit-icalls.h"
-#ifdef PLATFORM_MACOSX
+#ifdef HOST_DARWIN
#include <mach/mach.h>
#include <mach/mach_time.h>
#include <mach/clock.h>
return FALSE;
}
-#ifndef PLATFORM_MACOSX
+#ifndef HOST_DARWIN
void
mono_runtime_install_handlers (void)
{
#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
/*Apple likes to deliver SIGBUS for *0 */
-#ifdef PLATFORM_MACOSX
+#ifdef HOST_DARWIN
if (signo == SIGSEGV || signo == SIGBUS) {
#else
if (signo == SIGSEGV) {
add_signal_handler (SIGSEGV, mono_sigsegv_signal_handler, 0);
}
-#ifndef PLATFORM_MACOSX
+#ifndef HOST_DARWIN
void
mono_runtime_install_handlers (void)
{
static volatile gint32 sampling_thread_running;
-#ifdef PLATFORM_MACOSX
+#ifdef HOST_DARWIN
static clock_serv_t sampling_clock_service;
mono_profiler_get_sample_mode (NULL, &mode, NULL);
if (mode == MONO_PROFILER_SAMPLE_MODE_NONE) {
- mono_profiler_sampling_thread_sleep ();
+ mono_profiler_sampling_thread_wait ();
+
+ if (!InterlockedRead (&sampling_thread_running))
+ goto done;
+
goto init;
}
clock_init (mode);
for (guint64 sleep = clock_get_time_ns (); InterlockedRead (&sampling_thread_running); clock_sleep_ns_abs (sleep)) {
- uint64_t freq;
+ uint32_t freq;
MonoProfilerSampleMode new_mode;
mono_profiler_get_sample_mode (NULL, &new_mode, &freq);
} FOREACH_THREAD_SAFE_END
}
- InterlockedWrite (&sampling_thread_exiting, 1);
-
clock_cleanup ();
+done:
+ InterlockedWrite (&sampling_thread_exiting, 1);
+
pthread_setschedparam (pthread_self (), old_policy, &old_sched);
mono_thread_info_detach ();
{
InterlockedWrite (&sampling_thread_running, 0);
-#ifndef PLATFORM_MACOSX
+ mono_profiler_sampling_thread_post ();
+
+#ifndef HOST_DARWIN
/*
* There is a slight problem when we're using CLOCK_PROCESS_CPUTIME_ID: If
* we're shutting down and there's largely no activity in the process other
* get us a 100% sampling rate. However, this may interfere with the GC's
* STW logic. Could perhaps be solved by taking the suspend lock.
*/
-#if defined (USE_POSIX_BACKEND) && defined (SIGRTMIN) && !defined (PLATFORM_ANDROID)
+#if defined (USE_POSIX_BACKEND) && defined (SIGRTMIN) && !defined (HOST_ANDROID)
/* Just take the first real-time signal we can get. */
profiler_signal = mono_threads_suspend_search_alternative_signal ();
#else
memset (argv, 0, sizeof (char*) * 10);
-#if defined(PLATFORM_MACOSX)
+#if defined(HOST_DARWIN)
if (native_stack_with_lldb (crashed_pid, argv, commands, commands_filename))
goto exec;
#endif
if (native_stack_with_gdb (crashed_pid, argv, commands, commands_filename))
goto exec;
-#if !defined(PLATFORM_MACOSX)
+#if !defined(HOST_DARWIN)
if (native_stack_with_lldb (crashed_pid, argv, commands, commands_filename))
goto exec;
#endif