[runtime] Make mono_thread_manage external only (mono/mono#17554)
authorAleksey Kliger (λgeek) <alklig@microsoft.com>
Fri, 25 Oct 2019 15:28:18 +0000 (11:28 -0400)
committerGitHub <noreply@github.com>
Fri, 25 Oct 2019 15:28:18 +0000 (11:28 -0400)
* [runtime] Make mono_thread_manage external only

runtime should use mono_thread_manage_internal

Commit migrated from https://github.com/mono/mono/commit/d6ee245c94a8365c1d418ea82f9b83ce11cc53a3

src/mono/mono/metadata/coree.c
src/mono/mono/metadata/external-only.c
src/mono/mono/metadata/object.c
src/mono/mono/metadata/threads-types.h
src/mono/mono/metadata/threads.c
src/mono/mono/metadata/threads.h
src/mono/mono/mini/driver.c

index 9f09564..4f09ece 100644 (file)
@@ -214,7 +214,7 @@ __int32 STDMETHODCALLTYPE _CorExeMain(void)
 
        mono_runtime_run_main_checked (method, argc, argv, error);
        mono_error_raise_exception_deprecated (error); /* OK, triggers unhandled exn handler */
-       mono_thread_manage ();
+       mono_thread_manage_internal ();
 
        mono_runtime_quit ();
 
index 370fb3c..d3783f1 100644 (file)
@@ -21,6 +21,8 @@
 #include "object.h"
 #include "assembly-internals.h"
 #include "external-only.h"
+#include "threads.h"
+#include "threads-types.h"
 
 /**
  * mono_gchandle_new:
@@ -339,3 +341,13 @@ mono_assembly_name_free (MonoAssemblyName *aname)
                return;
        MONO_EXTERNAL_ONLY_GC_UNSAFE_VOID (mono_assembly_name_free_internal (aname));
 }
+
+/**
+ * mono_thread_manage:
+ *
+ */
+void
+mono_thread_manage (void)
+{
+       MONO_EXTERNAL_ONLY_GC_UNSAFE_VOID (mono_thread_manage_internal ());
+}
index 05b9fc7..dfbdb0e 100644 (file)
@@ -5092,7 +5092,7 @@ mono_runtime_exec_managed_code (MonoDomain *domain,
        mono_thread_create_checked (domain, mfunc, margs, error);
        mono_error_assert_ok (error);
 
-       mono_thread_manage ();
+       mono_thread_manage_internal ();
 
        MONO_EXIT_GC_UNSAFE;
 }
index 909ad4f..292407f 100644 (file)
@@ -106,6 +106,9 @@ mono_thread_create_internal_handle (MonoDomain *domain, T func, gpointer arg, Mo
 }
 #endif
 
+void
+mono_thread_manage_internal (void);
+
 /* Data owned by a MonoInternalThread that must live until both the finalizer
  * for MonoInternalThread has run, and the underlying machine thread has
  * detached.
index 1d1f11f..e5f7e16 100644 (file)
@@ -3679,11 +3679,13 @@ mono_threads_set_shutting_down (void)
 }
 
 /**
- * mono_thread_manage:
+ * mono_thread_manage_internal:
  */
 void
-mono_thread_manage (void)
+mono_thread_manage_internal (void)
 {
+       MONO_REQ_GC_UNSAFE_MODE;
+
        struct wait_data wait_data;
        struct wait_data *wait = &wait_data;
 
index 65020eb..52d76d8 100644 (file)
@@ -24,7 +24,8 @@ typedef mono_bool (*MonoThreadManageCallback) (MonoThread* thread);
 MONO_API void mono_thread_init (MonoThreadStartCB start_cb,
                              MonoThreadAttachCB attach_cb);
 MONO_API void mono_thread_cleanup (void);
-MONO_API void mono_thread_manage(void);
+MONO_API MONO_RT_EXTERNAL_ONLY
+void mono_thread_manage(void);
 
 MONO_API MonoThread *mono_thread_current (void);
 
index cce7f34..0adee5f 100644 (file)
@@ -1247,7 +1247,7 @@ compile_all_methods (MonoAssembly *ass, int verbose, guint32 opts, guint32 recom
        mono_thread_create_checked (mono_domain_get (), (gpointer)compile_all_methods_thread_main, &args, error);
        mono_error_assert_ok (error);
 
-       mono_thread_manage ();
+       mono_thread_manage_internal ();
 }
 
 /**
@@ -2620,7 +2620,7 @@ mono_main (int argc, char* argv[])
                main_args.opts = opt;
                main_args.aot_options = aot_options;
                main_thread_handler (&main_args);
-               mono_thread_manage ();
+               mono_thread_manage_internal ();
 
                mini_cleanup (domain);
 
@@ -2799,7 +2799,7 @@ void
 mono_jit_cleanup (MonoDomain *domain)
 {
        MONO_ENTER_GC_UNSAFE;
-       mono_thread_manage ();
+       mono_thread_manage_internal ();
 
        mini_cleanup (domain);
        MONO_EXIT_GC_UNSAFE;