Update PointConverter.cs
[mono.git] / mono / metadata / runtime.c
1 /*
2  * runtime.c: Runtime functions
3  *
4  * Authors:
5  *  Jonathan Pryor 
6  *
7  * Copyright 2010 Novell, Inc (http://www.novell.com)
8  */
9
10 #include <config.h>
11
12 #include <glib.h>
13
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>
20
21 static void
22 fire_process_exit_event (MonoDomain *domain, gpointer user_data)
23 {
24         MonoClassField *field;
25         gpointer pa [2];
26         MonoObject *delegate, *exc;
27
28         field = mono_class_get_field_from_name (mono_defaults.appdomain_class, "ProcessExit");
29         g_assert (field);
30
31         delegate = *(MonoObject **)(((char *)domain->domain) + field->offset); 
32         if (delegate == NULL)
33                 return;
34
35         pa [0] = domain;
36         pa [1] = NULL;
37         mono_runtime_delegate_invoke (delegate, pa, &exc);
38 }
39
40 static void
41 mono_runtime_fire_process_exit_event (void)
42 {
43 #ifndef MONO_CROSS_COMPILE
44         mono_domain_foreach (fire_process_exit_event, NULL);
45 #endif
46 }
47
48 /*
49 Initialize runtime shutdown.
50 After this call completes the thread pool will stop accepting new jobs and
51
52 */
53 void
54 mono_runtime_shutdown (void)
55 {
56         mono_runtime_fire_process_exit_event ();
57
58         mono_threads_set_shutting_down ();
59
60         /* No new threads will be created after this point */
61
62         mono_runtime_set_shutting_down ();
63
64 }
65
66
67 gboolean
68 mono_runtime_is_critical_method (MonoMethod *method)
69 {
70         if (mono_monitor_is_il_fastpath_wrapper (method))
71                 return TRUE;
72         return FALSE;
73 }