X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Futils%2Fmono-threads-windows.c;h=563d210e8ed5cfe9ef657e7aba24d77d0f0429cf;hb=ed1884bb9b43ddd69daba52302494ad2d02bbbd9;hp=c20cefd5cdf9b8bc367ba728166bed88bd504de2;hpb=8c0645dab9ccc90da201e714de20804ba5339cfc;p=mono.git diff --git a/mono/utils/mono-threads-windows.c b/mono/utils/mono-threads-windows.c index c20cefd5cdf..563d210e8ed 100644 --- a/mono/utils/mono-threads-windows.c +++ b/mono/utils/mono-threads-windows.c @@ -218,19 +218,26 @@ mono_native_thread_create (MonoNativeThreadId *tid, gpointer func, gpointer arg) return CreateThread (NULL, 0, (func), (arg), 0, (tid)) != NULL; } +gboolean +mono_native_thread_join_handle (HANDLE thread_handle, gboolean close_handle) +{ + DWORD res = WaitForSingleObject (thread_handle, INFINITE); + + if (close_handle) + CloseHandle (thread_handle); + + return res != WAIT_FAILED; +} + gboolean mono_native_thread_join (MonoNativeThreadId tid) { HANDLE handle; - if (!(handle = OpenThread (THREAD_ALL_ACCESS, TRUE, tid))) + if (!(handle = OpenThread (SYNCHRONIZE, TRUE, tid))) return FALSE; - DWORD res = WaitForSingleObject (handle, INFINITE); - - CloseHandle (handle); - - return res != WAIT_FAILED; + return mono_native_thread_join_handle (handle, TRUE); } #if HAVE_DECL___READFSDWORD==0