From: Ludovic Henry Date: Sat, 3 Dec 2016 23:42:04 +0000 (-0500) Subject: [runtime] Fix build X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=8fc79cf5e303ead7ceb80157365a0ebee7ad22de;p=mono.git [runtime] Fix build --- diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c index 43bbeab13e4..47b4b691690 100644 --- a/mono/metadata/threads.c +++ b/mono/metadata/threads.c @@ -1615,6 +1615,47 @@ mono_thread_internal_current (void) return res; } +static MonoThreadInfoWaitRet +mono_join_uninterrupted (MonoThreadHandle* thread_to_join, gint32 ms, MonoError *error) +{ + MonoException *exc; + MonoThreadInfoWaitRet ret; + gint64 start; + gint32 diff_ms; + gint32 wait = ms; + + mono_error_init (error); + + start = (ms == -1) ? 0 : mono_msec_ticks (); + for (;;) { + MONO_ENTER_GC_SAFE; + ret = mono_thread_info_wait_one_handle (thread_to_join, ms, TRUE); + MONO_EXIT_GC_SAFE; + + if (ret != MONO_THREAD_INFO_WAIT_RET_ALERTED) + return ret; + + exc = mono_thread_execute_interruption (); + if (exc) { + mono_error_set_exception_instance (error, exc); + return ret; + } + + if (ms == -1) + continue; + + /* Re-calculate ms according to the time passed */ + diff_ms = (gint32)(mono_msec_ticks () - start); + if (diff_ms >= ms) { + ret = MONO_THREAD_INFO_WAIT_RET_TIMEOUT; + return ret; + } + wait = ms - diff_ms; + } + + return ret; +} + gboolean ves_icall_System_Threading_Thread_Join_internal(MonoThread *this_obj, int ms) { @@ -1734,47 +1775,6 @@ mono_wait_uninterrupted (MonoInternalThread *thread, guint32 numhandles, gpointe return ret; } -static MonoThreadInfoWaitRet -mono_join_uninterrupted (MonoThreadHandle* thread_to_join, gint32 ms, MonoError *error) -{ - MonoException *exc; - MonoThreadInfoWaitRet ret; - gint64 start; - gint32 diff_ms; - gint32 wait = ms; - - mono_error_init (error); - - start = (ms == -1) ? 0 : mono_msec_ticks (); - for (;;) { - MONO_ENTER_GC_SAFE; - ret = mono_thread_info_wait_one_handle (thread_to_join, ms, TRUE); - MONO_EXIT_GC_SAFE; - - if (ret != MONO_THREAD_INFO_WAIT_RET_ALERTED) - return ret; - - exc = mono_thread_execute_interruption (); - if (exc) { - mono_error_set_exception_instance (error, exc); - return ret; - } - - if (ms == -1) - continue; - - /* Re-calculate ms according to the time passed */ - diff_ms = (gint32)(mono_msec_ticks () - start); - if (diff_ms >= ms) { - ret = MONO_THREAD_INFO_WAIT_RET_TIMEOUT; - return ret; - } - wait = ms - diff_ms; - } - - return ret; -} - gint32 ves_icall_System_Threading_WaitHandle_WaitAll_internal(MonoArray *mono_handles, gint32 ms) { MonoError error;