int mono_sgen_thread_handshake (int signum) { int count, result; SgenThreadInfo *info; pthread_t me = pthread_self (); count = 0; FOREACH_THREAD (info) { if (ARCH_THREAD_EQUALS (info->id, me)) { continue; } /*if (signum == suspend_signal_num && info->stop_count == global_stop_count) continue;*/ result = pthread_kill (info->id, signum); if (result == 0) { count++; } else { info->skip = 1; } } END_FOREACH_THREAD mono_sgen_wait_for_suspend_ack (count); return count; }
int mono_sgen_thread_handshake (BOOL suspend) { int count, result; SgenThreadInfo *info; int signum = suspend ? suspend_signal_num : restart_signal_num; MonoNativeThreadId me = mono_native_thread_id_get (); count = 0; FOREACH_THREAD_SAFE (info) { if (mono_native_thread_id_equals (mono_thread_info_get_tid (info), me)) { continue; } /*if (signum == suspend_signal_num && info->stop_count == global_stop_count) continue;*/ if (suspend) { g_assert (!info->doing_handshake); info->doing_handshake = TRUE; } else { g_assert (info->doing_handshake); info->doing_handshake = FALSE; } result = pthread_kill (mono_thread_info_get_tid (info), signum); if (result == 0) { count++; } else { info->skip = 1; } } END_FOREACH_THREAD_SAFE mono_sgen_wait_for_suspend_ack (count); return count; }