[threads] Make mono_thread_detach_if_exiting return if it detached
authorLudovic Henry <ludovic@xamarin.com>
Mon, 30 May 2016 18:19:19 +0000 (20:19 +0200)
committerLudovic Henry <ludovic@xamarin.com>
Thu, 2 Jun 2016 21:25:31 +0000 (23:25 +0200)
mono/metadata/threads.c
mono/metadata/threads.h

index 8309ddbb540da1ad067185f315898d8e89a77cd6..63bb06d54166fe9d4e07935558ead1b6182cc23c 100644 (file)
@@ -1083,7 +1083,7 @@ mono_thread_detach (MonoThread *thread)
  * This should be used at the end of embedding code which calls into managed code, and which
  * can be called from pthread dtors, like dealloc: implementations in objective-c.
  */
-void
+mono_bool
 mono_thread_detach_if_exiting (void)
 {
        if (mono_thread_info_is_exiting ()) {
@@ -1093,8 +1093,10 @@ mono_thread_detach_if_exiting (void)
                if (thread) {
                        mono_thread_detach_internal (thread);
                        mono_thread_info_detach ();
+                       return TRUE;
                }
        }
+       return FALSE;
 }
 
 void
index b72072f3246ca5e69329de13afb80229699d5699..2ab8b09ea066069f17df38e3deb1ab59945ed9dc 100644 (file)
@@ -54,7 +54,7 @@ MONO_API void mono_threads_request_thread_dump (void);
 
 MONO_API mono_bool mono_thread_is_foreign (MonoThread *thread);
 
-extern MONO_API void mono_thread_detach_if_exiting (void);
+extern MONO_API mono_bool mono_thread_detach_if_exiting (void);
 
 MONO_END_DECLS