[threadpool] Split domain and worker management (#4117)
[mono.git] / mono / metadata / runtime.c
index 1c41c797db4fa2c235cd84398bf04cdf7f45541b..99621d5cca0f33c0075c81b4343b84f7f6358033 100644 (file)
@@ -18,7 +18,7 @@
 #include <mono/metadata/runtime.h>
 #include <mono/metadata/monitor.h>
 #include <mono/metadata/threads-types.h>
-#include <mono/metadata/threadpool-ms.h>
+#include <mono/metadata/threadpool.h>
 #include <mono/metadata/marshal.h>
 #include <mono/utils/atomic.h>
 
@@ -57,6 +57,7 @@ mono_runtime_is_shutting_down (void)
 static void
 fire_process_exit_event (MonoDomain *domain, gpointer user_data)
 {
+       MonoError error;
        MonoClassField *field;
        gpointer pa [2];
        MonoObject *delegate, *exc;
@@ -70,7 +71,8 @@ fire_process_exit_event (MonoDomain *domain, gpointer user_data)
 
        pa [0] = domain;
        pa [1] = NULL;
-       mono_runtime_delegate_invoke (delegate, pa, &exc);
+       mono_runtime_delegate_try_invoke (delegate, pa, &exc, &error);
+       mono_error_cleanup (&error);
 }
 
 static void
@@ -108,7 +110,7 @@ mono_runtime_try_shutdown (void)
        mono_runtime_set_shutting_down ();
 
        /* This will kill the tp threads which cannot be suspended */
-       mono_threadpool_ms_cleanup ();
+       mono_threadpool_cleanup ();
 
        /*TODO move the follow to here:
        mono_thread_suspend_all_other_threads (); OR  mono_thread_wait_all_other_threads