Commit 770918a9 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

mscoree: Do a "normal" runtime shutdown from _CorExeMain.

This needs to work differently from CorExitProcess because we need to wait for foreground threads and abort the rest.
parent 6b889fe9
...@@ -1034,7 +1034,7 @@ __int32 WINAPI _CorExeMain(void) ...@@ -1034,7 +1034,7 @@ __int32 WINAPI _CorExeMain(void)
int exit_code; int exit_code;
int argc; int argc;
char **argv; char **argv;
MonoDomain *domain; MonoDomain *domain=NULL;
MonoImage *image; MonoImage *image;
MonoImageOpenStatus status; MonoImageOpenStatus status;
MonoAssembly *assembly=NULL; MonoAssembly *assembly=NULL;
...@@ -1101,7 +1101,11 @@ __int32 WINAPI _CorExeMain(void) ...@@ -1101,7 +1101,11 @@ __int32 WINAPI _CorExeMain(void)
HeapFree(GetProcessHeap(), 0, argv); HeapFree(GetProcessHeap(), 0, argv);
unload_all_runtimes(); if (domain)
{
mono_thread_manage();
mono_jit_cleanup(domain);
}
return exit_code; return exit_code;
} }
......
...@@ -88,6 +88,7 @@ static void (CDECL *mono_free)(void *); ...@@ -88,6 +88,7 @@ static void (CDECL *mono_free)(void *);
static MonoImage* (CDECL *mono_image_open)(const char *fname, MonoImageOpenStatus *status); static MonoImage* (CDECL *mono_image_open)(const char *fname, MonoImageOpenStatus *status);
MonoImage* (CDECL *mono_image_open_from_module_handle)(HMODULE module_handle, char* fname, UINT has_entry_point, MonoImageOpenStatus* status); MonoImage* (CDECL *mono_image_open_from_module_handle)(HMODULE module_handle, char* fname, UINT has_entry_point, MonoImageOpenStatus* status);
static void (CDECL *mono_install_assembly_preload_hook)(MonoAssemblyPreLoadFunc func, void *user_data); static void (CDECL *mono_install_assembly_preload_hook)(MonoAssemblyPreLoadFunc func, void *user_data);
void (CDECL *mono_jit_cleanup)(MonoDomain *domain);
int (CDECL *mono_jit_exec)(MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]); int (CDECL *mono_jit_exec)(MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]);
MonoDomain* (CDECL *mono_jit_init)(const char *file); MonoDomain* (CDECL *mono_jit_init)(const char *file);
static int (CDECL *mono_jit_set_trace_options)(const char* options); static int (CDECL *mono_jit_set_trace_options)(const char* options);
...@@ -106,6 +107,7 @@ static void (CDECL *mono_set_verbose_level)(DWORD level); ...@@ -106,6 +107,7 @@ static void (CDECL *mono_set_verbose_level)(DWORD level);
MonoString* (CDECL *mono_string_new)(MonoDomain *domain, const char *str); MonoString* (CDECL *mono_string_new)(MonoDomain *domain, const char *str);
static char* (CDECL *mono_stringify_assembly_name)(MonoAssemblyName *aname); static char* (CDECL *mono_stringify_assembly_name)(MonoAssemblyName *aname);
MonoThread* (CDECL *mono_thread_attach)(MonoDomain *domain); MonoThread* (CDECL *mono_thread_attach)(MonoDomain *domain);
void (CDECL *mono_thread_manage)(void);
static void (CDECL *mono_thread_pool_cleanup)(void); static void (CDECL *mono_thread_pool_cleanup)(void);
static void (CDECL *mono_thread_suspend_all_other_threads)(void); static void (CDECL *mono_thread_suspend_all_other_threads)(void);
static void (CDECL *mono_threads_set_shutting_down)(void); static void (CDECL *mono_threads_set_shutting_down)(void);
...@@ -204,6 +206,7 @@ static HRESULT load_mono(CLRRuntimeInfo *This) ...@@ -204,6 +206,7 @@ static HRESULT load_mono(CLRRuntimeInfo *This)
LOAD_MONO_FUNCTION(mono_free); LOAD_MONO_FUNCTION(mono_free);
LOAD_MONO_FUNCTION(mono_image_open); LOAD_MONO_FUNCTION(mono_image_open);
LOAD_MONO_FUNCTION(mono_install_assembly_preload_hook); LOAD_MONO_FUNCTION(mono_install_assembly_preload_hook);
LOAD_MONO_FUNCTION(mono_jit_cleanup);
LOAD_MONO_FUNCTION(mono_jit_exec); LOAD_MONO_FUNCTION(mono_jit_exec);
LOAD_MONO_FUNCTION(mono_jit_init); LOAD_MONO_FUNCTION(mono_jit_init);
LOAD_MONO_FUNCTION(mono_jit_set_trace_options); LOAD_MONO_FUNCTION(mono_jit_set_trace_options);
...@@ -221,6 +224,7 @@ static HRESULT load_mono(CLRRuntimeInfo *This) ...@@ -221,6 +224,7 @@ static HRESULT load_mono(CLRRuntimeInfo *This)
LOAD_MONO_FUNCTION(mono_stringify_assembly_name); LOAD_MONO_FUNCTION(mono_stringify_assembly_name);
LOAD_MONO_FUNCTION(mono_string_new); LOAD_MONO_FUNCTION(mono_string_new);
LOAD_MONO_FUNCTION(mono_thread_attach); LOAD_MONO_FUNCTION(mono_thread_attach);
LOAD_MONO_FUNCTION(mono_thread_manage);
LOAD_MONO_FUNCTION(mono_trace_set_assembly); LOAD_MONO_FUNCTION(mono_trace_set_assembly);
#undef LOAD_MONO_FUNCTION #undef LOAD_MONO_FUNCTION
......
...@@ -145,6 +145,7 @@ extern MonoClass* (CDECL *mono_class_from_mono_type)(MonoType *type); ...@@ -145,6 +145,7 @@ extern MonoClass* (CDECL *mono_class_from_mono_type)(MonoType *type);
extern MonoClass* (CDECL *mono_class_from_name)(MonoImage *image, const char* name_space, const char *name); extern MonoClass* (CDECL *mono_class_from_name)(MonoImage *image, const char* name_space, const char *name);
extern MonoMethod* (CDECL *mono_class_get_method_from_name)(MonoClass *klass, const char *name, int param_count); extern MonoMethod* (CDECL *mono_class_get_method_from_name)(MonoClass *klass, const char *name, int param_count);
extern MonoAssembly* (CDECL *mono_domain_assembly_open)(MonoDomain *domain, const char *name); extern MonoAssembly* (CDECL *mono_domain_assembly_open)(MonoDomain *domain, const char *name);
extern void (CDECL *mono_jit_cleanup)(MonoDomain *domain);
extern int (CDECL *mono_jit_exec)(MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]); extern int (CDECL *mono_jit_exec)(MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]);
extern MonoDomain* (CDECL *mono_jit_init)(const char *file); extern MonoDomain* (CDECL *mono_jit_init)(const char *file);
extern MonoImage* (CDECL *mono_image_open_from_module_handle)(HMODULE module_handle, char* fname, UINT has_entry_point, MonoImageOpenStatus* status); extern MonoImage* (CDECL *mono_image_open_from_module_handle)(HMODULE module_handle, char* fname, UINT has_entry_point, MonoImageOpenStatus* status);
...@@ -157,6 +158,7 @@ extern MonoObject* (CDECL *mono_runtime_invoke)(MonoMethod *method, void *obj, v ...@@ -157,6 +158,7 @@ extern MonoObject* (CDECL *mono_runtime_invoke)(MonoMethod *method, void *obj, v
extern void (CDECL *mono_runtime_object_init)(MonoObject *this_obj); extern void (CDECL *mono_runtime_object_init)(MonoObject *this_obj);
extern MonoString* (CDECL *mono_string_new)(MonoDomain *domain, const char *str); extern MonoString* (CDECL *mono_string_new)(MonoDomain *domain, const char *str);
extern MonoThread* (CDECL *mono_thread_attach)(MonoDomain *domain); extern MonoThread* (CDECL *mono_thread_attach)(MonoDomain *domain);
extern void (CDECL *mono_thread_manage)(void);
extern void (CDECL *mono_trace_set_assembly)(MonoAssembly *assembly); extern void (CDECL *mono_trace_set_assembly)(MonoAssembly *assembly);
/* loaded runtime interfaces */ /* loaded runtime interfaces */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment