[threads] Remove unused mono_thread_internal_stop (#4449)
authorLudovic Henry <ludovic@xamarin.com>
Wed, 1 Mar 2017 19:19:58 +0000 (14:19 -0500)
committerGitHub <noreply@github.com>
Wed, 1 Mar 2017 19:19:58 +0000 (14:19 -0500)
mono/metadata/threads-types.h
mono/metadata/threads.c

index e6a1011d201d5c9c17216573840aca7760b24b17..a63a741f4a941e186f5b6122c7aa6efb5bbf9244 100644 (file)
@@ -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);
 
index 3461f81e325c6dde6063bb487799a5d24b4baf02..238abb9504cb949f0d247daefa9d7dca32bbc40d 100644 (file)
@@ -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);