static DWORD WINAPI inner_start_thread (LPVOID arg) { ThreadStartInfo *start_info = arg; void *t_arg = start_info->arg; int post_result; LPTHREAD_START_ROUTINE start_func = start_info->start_routine; DWORD result; gboolean suspend = start_info->suspend; HANDLE suspend_event = start_info->suspend_event; MonoThreadInfo *info; info = mono_thread_info_attach (&result); info->runtime_thread = TRUE; info->create_suspended = suspend; post_result = MONO_SEM_POST (&(start_info->registered)); g_assert (!post_result); if (suspend) { WaitForSingleObject (suspend_event, INFINITE); /* caller will suspend the thread before setting the event. */ CloseHandle (suspend_event); } result = start_func (t_arg); mono_thread_info_detach (); return result; }
/* * mono_thread_info_exit: * * Exit the current thread. * This function doesn't return. */ void mono_thread_info_exit (gsize exit_code) { #if defined(__native_client__) nacl_shutdown_gc_thread(); #endif mono_thread_info_detach (); mono_threads_platform_exit (0); }
void mono_threads_core_exit (int exit_code) { MonoThreadInfo *current = mono_thread_info_current (); #if defined(__native_client__) nacl_shutdown_gc_thread(); #endif wapi_thread_handle_set_exited (current->handle, exit_code); mono_thread_info_detach (); pthread_exit (NULL); }
BOOL APIENTRY DllMain (HMODULE module_handle, DWORD reason, LPVOID reserved) { if (!mono_gc_dllmain (module_handle, reason, reserved)) return FALSE; switch (reason) { case DLL_PROCESS_ATTACH: mono_install_runtime_load (mini_init); break; case DLL_PROCESS_DETACH: if (coree_module_handle) FreeLibrary (coree_module_handle); break; case DLL_THREAD_DETACH: mono_thread_info_detach (); break; } return TRUE; }