From d01c819b05550d430d3c1bf0cc6842a2e8a47a0d Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Wed, 1 Mar 2017 14:19:58 -0500 Subject: [PATCH] [threads] Remove unused mono_thread_internal_stop (#4449) --- mono/metadata/threads-types.h | 1 - mono/metadata/threads.c | 52 +++++++++-------------------------- 2 files changed, 13 insertions(+), 40 deletions(-) diff --git a/mono/metadata/threads-types.h b/mono/metadata/threads-types.h index e6a1011d201..a63a741f4a9 100644 --- a/mono/metadata/threads-types.h +++ b/mono/metadata/threads-types.h @@ -176,7 +176,6 @@ MonoInternalThread *mono_thread_internal_current (void); void mono_thread_internal_check_for_interruption_critical (MonoInternalThread *thread); -void mono_thread_internal_stop (MonoInternalThread *thread); void mono_thread_internal_abort (MonoInternalThread *thread); void mono_thread_internal_suspend_for_shutdown (MonoInternalThread *thread); diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c index 3461f81e325..238abb9504c 100644 --- a/mono/metadata/threads.c +++ b/mono/metadata/threads.c @@ -2630,53 +2630,27 @@ is_running_protected_wrapper (void) return found; } -static gboolean -request_thread_stop (MonoInternalThread *thread) +void +mono_thread_stop (MonoThread *thread) { - LOCK_THREAD (thread); + MonoInternalThread *internal = thread->internal_thread; - if ((thread->state & ThreadState_StopRequested) != 0 || - (thread->state & ThreadState_Stopped) != 0) + LOCK_THREAD (internal); + + if (internal->state & (ThreadState_StopRequested | ThreadState_Stopped)) { - UNLOCK_THREAD (thread); - return FALSE; + UNLOCK_THREAD (internal); + return; } - - /* Make sure the thread is awake */ - mono_thread_resume (thread); - thread->state |= ThreadState_StopRequested; - thread->state &= ~ThreadState_AbortRequested; - - UNLOCK_THREAD (thread); - return TRUE; -} + /* Make sure the internal is awake */ + mono_thread_resume (internal); -/** - * mono_thread_internal_stop: - * - * Request thread @thread to stop. - * - * @thread MUST NOT be the current thread. - */ -void -mono_thread_internal_stop (MonoInternalThread *thread) -{ - g_assert (thread != mono_thread_internal_current ()); + internal->state |= ThreadState_StopRequested; + internal->state &= ~ThreadState_AbortRequested; - if (!request_thread_stop (thread)) - return; - - async_abort_internal (thread, TRUE); -} - -void mono_thread_stop (MonoThread *thread) -{ - MonoInternalThread *internal = thread->internal_thread; + UNLOCK_THREAD (internal); - if (!request_thread_stop (internal)) - return; - if (internal == mono_thread_internal_current ()) { MonoError error; self_abort_internal (&error); -- 2.25.1