Add mono_threads_core_set_name() on Mac.
[mono.git] / mono / utils / mono-threads-mach.c
index ddc8ae1cbb54e09ffe05ced24a730d2038307a2b..e8011d350f9e75139ac87b62f6fd2c6aac05e47a 100644 (file)
@@ -25,7 +25,8 @@
 
 void
 mono_threads_init_platform (void)
-{      
+{
+       mono_threads_init_dead_letter ();
 }
 
 void
@@ -34,17 +35,33 @@ mono_threads_core_interrupt (MonoThreadInfo *info)
        thread_abort (info->native_handle);
 }
 
+void
+mono_threads_core_abort_syscall (MonoThreadInfo *info)
+{
+}
+
+gboolean
+mono_threads_core_needs_abort_syscall (void)
+{
+       return FALSE;
+}
+
 gboolean
 mono_threads_core_suspend (MonoThreadInfo *info)
 {
        kern_return_t ret;
+       gboolean res;
+
        g_assert (info);
 
        ret = thread_suspend (info->native_handle);
        if (ret != KERN_SUCCESS)
                return FALSE;
-       return mono_threads_get_runtime_callbacks ()->
+       res = mono_threads_get_runtime_callbacks ()->
                thread_state_init_from_handle (&info->suspend_state, mono_thread_info_get_tid (info), info->native_handle);
+       if (!res)
+               thread_resume (info->native_handle);
+       return res;
 }
 
 gboolean
@@ -89,6 +106,7 @@ void
 mono_threads_platform_register (MonoThreadInfo *info)
 {
        info->native_handle = mach_thread_self ();
+       mono_threads_install_dead_letter ();
 }
 
 void
@@ -120,4 +138,10 @@ mono_native_thread_create (MonoNativeThreadId *tid, gpointer func, gpointer arg)
        return pthread_create (tid, NULL, func, arg) == 0;
 }
 
+void
+mono_threads_core_set_name (MonoNativeThreadId tid, const char *name)
+{
+       /* pthread_setnmae_np() on Mac is not documented and doesn't receive thread id. */
+}
+
 #endif