2 * runtime.c: Runtime functions
7 * Copyright 2010 Novell, Inc (http://www.novell.com)
14 #include <mono/metadata/appdomain.h>
15 #include <mono/metadata/class.h>
16 #include <mono/metadata/class-internals.h>
17 #include <mono/metadata/runtime.h>
18 #include <mono/metadata/monitor.h>
19 #include <mono/metadata/threads-types.h>
22 fire_process_exit_event (MonoDomain *domain, gpointer user_data)
24 MonoClassField *field;
26 MonoObject *delegate, *exc;
28 field = mono_class_get_field_from_name (mono_defaults.appdomain_class, "ProcessExit");
31 delegate = *(MonoObject **)(((char *)domain->domain) + field->offset);
37 mono_runtime_delegate_invoke (delegate, pa, &exc);
41 mono_runtime_fire_process_exit_event (void)
43 #ifndef MONO_CROSS_COMPILE
44 mono_domain_foreach (fire_process_exit_event, NULL);
49 Initialize runtime shutdown.
50 After this call completes the thread pool will stop accepting new jobs and
54 mono_runtime_shutdown (void)
56 mono_runtime_fire_process_exit_event ();
58 mono_threads_set_shutting_down ();
60 /* No new threads will be created after this point */
62 mono_runtime_set_shutting_down ();
68 mono_runtime_is_critical_method (MonoMethod *method)
70 if (mono_monitor_is_il_fastpath_wrapper (method))