예제 #1
0
int
mono_sgen_thread_handshake (BOOL suspend)
{
	SgenThreadInfo *info;
	SgenThreadInfo *current = mono_thread_info_current ();
	int count = 0;

	FOREACH_THREAD_SAFE (info) {
		if (info == current)
			continue;
		if (suspend) {
			g_assert (!info->doing_handshake);
			info->doing_handshake = TRUE;

			if (!mono_sgen_suspend_thread (info))
				continue;
		} else {
			g_assert (info->doing_handshake);
			info->doing_handshake = FALSE;

			if (!mono_sgen_resume_thread (info))
				continue;
		}

		++count;
	} END_FOREACH_THREAD_SAFE
	return count;
}
예제 #2
0
파일: sgen-os-mach.c 프로젝트: mantasp/mono
/* LOCKING: assumes the GC lock is held */
int
mono_sgen_thread_handshake (int signum)
{
	SgenThreadInfo *cur_thread = mono_sgen_thread_info_current ();
	kern_return_t ret;

	SgenThreadInfo *info;

	int count = 0;

	FOREACH_THREAD (info) {
		if (info == cur_thread || mono_sgen_is_worker_thread (info->id))
			continue;

		if (signum == suspend_signal_num) {
			if (!mono_sgen_suspend_thread (info))
				continue;
		} else {
			ret = thread_resume (info->mach_port);
			if (ret != KERN_SUCCESS)
				continue;
		}
		count ++;
	} END_FOREACH_THREAD
	return count;
}