コード例 #1
0
ファイル: mono-threads.c プロジェクト: Andrea/mono
static void*
register_thread (MonoThreadInfo *info, gpointer baseptr)
{
	gboolean result;
	mono_thread_info_set_tid (info, mono_native_thread_id_get ());
	info->small_id = mono_thread_small_id_alloc ();

	InitializeCriticalSection (&info->suspend_lock);

	/*set TLS early so SMR works */
	mono_native_tls_set_value (thread_info_key, info);
	mono_native_tls_set_value (small_id_key, GUINT_TO_POINTER (info->small_id + 1));

	THREADS_DEBUG ("registering info %p tid %p small id %x\n", info, mono_thread_info_get_tid (info), info->small_id);

	if (threads_callbacks.thread_register) {
		if (threads_callbacks.thread_register (info, baseptr) == NULL) {
			g_warning ("thread registation failed\n");
			g_free (info);
			return NULL;
		}
	}

	mono_threads_platform_register (info);

	/*If this fail it means a given thread has been registered twice, which doesn't make sense. */
	result = mono_thread_info_insert (info);
	g_assert (result);
	return info;
}
コード例 #2
0
ファイル: mono-threads.c プロジェクト: glinos/mono
int
mono_thread_info_register_small_id (void)
{
	int small_id = mono_thread_small_id_alloc ();
	mono_native_tls_set_value (small_id_key, GUINT_TO_POINTER (small_id + 1));
	return small_id;
}
コード例 #3
0
ファイル: mono-threads.c プロジェクト: ileonchik/mono
int
mono_thread_info_register_small_id (void)
{
	int small_id = mono_thread_small_id_alloc ();
#ifdef HAVE_KW_THREAD
	tls_small_id = small_id;
#else
	mono_native_tls_set_value (small_id_key, GUINT_TO_POINTER (small_id + 1));
#endif
	return small_id;
}
コード例 #4
0
ファイル: hazard-pointer.c プロジェクト: LogosBible/mono
void
mono_thread_smr_init (void)
{
	int i;

	mono_os_mutex_init_recursive(&small_id_mutex);
	mono_counters_register ("Hazardous pointers", MONO_COUNTER_JIT | MONO_COUNTER_INT, &hazardous_pointer_count);

	for (i = 0; i < HAZARD_TABLE_OVERFLOW; ++i) {
		int small_id = mono_thread_small_id_alloc ();
		g_assert (small_id == i);
	}
}