[dtrace] GC begin/end probes for SGen.
[mono.git] / mono / metadata / sgen-os-mach.c
index af138e9fe9d354c3ad48b2108fe326edcf642120..c99debf9943963949dc2487155a95d352db3fc32 100644 (file)
 
 #if defined(__MACH__) && MONO_MACH_ARCH_SUPPORTED
 gboolean
-mono_sgen_resume_thread (SgenThreadInfo *info)
+sgen_resume_thread (SgenThreadInfo *info)
 {
        return thread_resume (info->mach_port) == KERN_SUCCESS;
 }
 
 gboolean
-mono_sgen_suspend_thread (SgenThreadInfo *info)
+sgen_suspend_thread (SgenThreadInfo *info)
 {
        mach_msg_type_number_t num_state;
        thread_state_t state;
@@ -95,20 +95,20 @@ mono_sgen_suspend_thread (SgenThreadInfo *info)
 
        /* Notify the JIT */
        if (mono_gc_get_gc_callbacks ()->thread_suspend_func)
-               mono_gc_get_gc_callbacks ()->thread_suspend_func (info->runtime_data, &ctx);
+               mono_gc_get_gc_callbacks ()->thread_suspend_func (info->runtime_data, &ctx, NULL);
 
        return TRUE;
 }
 
 void
-mono_sgen_wait_for_suspend_ack (int count)
+sgen_wait_for_suspend_ack (int count)
 {
     /* mach thread_resume is synchronous so we dont need to wait for them */
 }
 
 /* LOCKING: assumes the GC lock is held */
 int
-mono_sgen_thread_handshake (BOOL suspend)
+sgen_thread_handshake (BOOL suspend)
 {
        SgenThreadInfo *cur_thread = mono_thread_info_current ();
        kern_return_t ret;
@@ -117,7 +117,11 @@ mono_sgen_thread_handshake (BOOL suspend)
        int count = 0;
 
        FOREACH_THREAD_SAFE (info) {
-               if (info == cur_thread || mono_sgen_is_worker_thread (mono_thread_info_get_tid (info)))
+               if (info->joined_stw == suspend)
+                       continue;
+               info->joined_stw = suspend;
+
+               if (info == cur_thread || sgen_is_worker_thread (mono_thread_info_get_tid (info)))
                        continue;
                if (info->gc_disabled)
                        continue;
@@ -126,7 +130,7 @@ mono_sgen_thread_handshake (BOOL suspend)
                        g_assert (!info->doing_handshake);
                        info->doing_handshake = TRUE;
 
-                       if (!mono_sgen_suspend_thread (info))
+                       if (!sgen_suspend_thread (info))
                                continue;
                } else {
                        g_assert (info->doing_handshake);
@@ -142,7 +146,7 @@ mono_sgen_thread_handshake (BOOL suspend)
 }
 
 void
-mono_sgen_os_init (void)
+sgen_os_init (void)
 {
 }