X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=mono%2Futils%2Fmono-threads-windows.c;h=5d6774ed4d7ea1c051365f841939c9d407dcec22;hb=390697c8b2e2faf225440dc2b4c8ba73eb4dd85c;hp=3e7245062e1d21eb19902cc80051626d82955cb1;hpb=3470747e2965ab1b61a1f735cbcd22714b82dd24;p=mono.git diff --git a/mono/utils/mono-threads-windows.c b/mono/utils/mono-threads-windows.c index 3e7245062e1..5d6774ed4d7 100644 --- a/mono/utils/mono-threads-windows.c +++ b/mono/utils/mono-threads-windows.c @@ -187,6 +187,21 @@ mono_native_thread_create (MonoNativeThreadId *tid, gpointer func, gpointer arg) return CreateThread (NULL, 0, (func), (arg), 0, (tid)) != NULL; } +gboolean +mono_native_thread_join (MonoNativeThreadId tid) +{ + HANDLE handle; + + if (!(handle = OpenThread (THREAD_ALL_ACCESS, TRUE, tid))) + return FALSE; + + DWORD res = WaitForSingleObject (handle, INFINITE); + + CloseHandle (handle); + + return res != WAIT_FAILED; +} + #if HAVE_DECL___READFSDWORD==0 static MONO_ALWAYS_INLINE unsigned long long __readfsdword (unsigned long offset) @@ -243,7 +258,10 @@ mono_threads_platform_exit (int exit_code) void mono_threads_platform_unregister (MonoThreadInfo *info) { - mono_threads_platform_set_exited (info); + g_assert (info->handle); + + CloseHandle (info->handle); + info->handle = NULL; } int @@ -309,49 +327,8 @@ mono_native_thread_set_name (MonoNativeThreadId tid, const char *name) } void -mono_threads_platform_set_exited (MonoThreadInfo *info) -{ - g_assert (info->handle); - // No need to call CloseHandle() here since the InternalThread - // destructor will close the handle when the finalizer thread calls it - info->handle = NULL; -} - -void -mono_threads_platform_describe (MonoThreadInfo *info, GString *text) +mono_threads_platform_set_exited (gpointer handle) { - /* TODO */ -} - -void -mono_threads_platform_own_mutex (MonoThreadInfo *info, gpointer mutex_handle) -{ - g_assert_not_reached (); -} - -void -mono_threads_platform_disown_mutex (MonoThreadInfo *info, gpointer mutex_handle) -{ - g_assert_not_reached (); -} - -MonoThreadPriority -mono_threads_platform_get_priority (MonoThreadInfo *info) -{ - g_assert (info->handle); - return GetThreadPriority (info->handle) + 2; -} - -void -mono_threads_platform_set_priority (MonoThreadInfo *info, MonoThreadPriority priority) -{ - BOOL res; - - g_assert (info->handle); - - res = SetThreadPriority (info->handle, priority - 2); - if (!res) - g_error ("%s: SetThreadPriority failed, error %d", __func__, GetLastError ()); } void