{
MONO_ARCH_SAVE_REGS;
-#ifndef MONO_CROSS_COMPILE
mono_runtime_shutdown ();
-#endif
-
- mono_threads_set_shutting_down ();
-
- mono_runtime_set_shutting_down ();
/* This will kill the tp threads which cannot be suspended */
mono_thread_pool_cleanup ();
#include <mono/metadata/class-internals.h>
#include <mono/metadata/runtime.h>
#include <mono/metadata/monitor.h>
+#include <mono/metadata/threads-types.h>
static void
fire_process_exit_event (MonoDomain *domain, gpointer user_data)
mono_runtime_delegate_invoke (delegate, pa, &exc);
}
+static void
+mono_runtime_fire_process_exit_event (void)
+{
+#ifndef MONO_CROSS_COMPILE
+ mono_domain_foreach (fire_process_exit_event, NULL);
+#endif
+}
+
+/*
+Initialize runtime shutdown.
+After this call completes the thread pool will stop accepting new jobs and
+
+*/
void
mono_runtime_shutdown (void)
{
- mono_domain_foreach (fire_process_exit_event, NULL);
+ mono_runtime_fire_process_exit_event ();
+
+ mono_threads_set_shutting_down ();
+
+ /* No new threads will be created after this point */
+
+ mono_runtime_set_shutting_down ();
+
}
THREAD_DEBUG (g_message ("%s: I have %d threads after waiting.", __func__, wait->num));
} while(wait->num>0);
-#ifndef MONO_CROSS_COMPILE
mono_runtime_shutdown ();
-#endif
-
- mono_threads_set_shutting_down ();
-
- /* No new threads will be created after this point */
-
- mono_runtime_set_shutting_down ();
THREAD_DEBUG (g_message ("%s: threadpool cleanup", __func__));
mono_thread_pool_cleanup ();
#include <mono/metadata/threads-types.h>
#include <mono/metadata/socket-io.h>
#include <mono/metadata/assembly.h>
+#include <mono/metadata/runtime.h>
#include <mono/utils/mono-semaphore.h>
#include <mono/utils/mono-error-internals.h>
#include <mono/utils/mono-stack-unwinding.h>
while (suspend_count > 0)
resume_vm ();
- mono_runtime_set_shutting_down ();
-
- mono_threads_set_shutting_down ();
+ mono_runtime_shutdown ();
/* Suspend all managed threads since the runtime is going away */
DEBUG(1, fprintf (log_file, "Suspending all threads...\n"));