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.
This commit is contained in:
Vincent Povirk 2013-10-24 15:17:24 -05:00 committed by Alexandre Julliard
parent 6b889fe918
commit 770918a91b
3 changed files with 12 additions and 2 deletions

View File

@ -1034,7 +1034,7 @@ __int32 WINAPI _CorExeMain(void)
int exit_code;
int argc;
char **argv;
MonoDomain *domain;
MonoDomain *domain=NULL;
MonoImage *image;
MonoImageOpenStatus status;
MonoAssembly *assembly=NULL;
@ -1101,7 +1101,11 @@ __int32 WINAPI _CorExeMain(void)
HeapFree(GetProcessHeap(), 0, argv);
unload_all_runtimes();
if (domain)
{
mono_thread_manage();
mono_jit_cleanup(domain);
}
return exit_code;
}

View File

@ -88,6 +88,7 @@ static void (CDECL *mono_free)(void *);
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);
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[]);
MonoDomain* (CDECL *mono_jit_init)(const char *file);
static int (CDECL *mono_jit_set_trace_options)(const char* options);
@ -106,6 +107,7 @@ static void (CDECL *mono_set_verbose_level)(DWORD level);
MonoString* (CDECL *mono_string_new)(MonoDomain *domain, const char *str);
static char* (CDECL *mono_stringify_assembly_name)(MonoAssemblyName *aname);
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_suspend_all_other_threads)(void);
static void (CDECL *mono_threads_set_shutting_down)(void);
@ -204,6 +206,7 @@ static HRESULT load_mono(CLRRuntimeInfo *This)
LOAD_MONO_FUNCTION(mono_free);
LOAD_MONO_FUNCTION(mono_image_open);
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_init);
LOAD_MONO_FUNCTION(mono_jit_set_trace_options);
@ -221,6 +224,7 @@ static HRESULT load_mono(CLRRuntimeInfo *This)
LOAD_MONO_FUNCTION(mono_stringify_assembly_name);
LOAD_MONO_FUNCTION(mono_string_new);
LOAD_MONO_FUNCTION(mono_thread_attach);
LOAD_MONO_FUNCTION(mono_thread_manage);
LOAD_MONO_FUNCTION(mono_trace_set_assembly);
#undef LOAD_MONO_FUNCTION

View File

@ -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 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 void (CDECL *mono_jit_cleanup)(MonoDomain *domain);
extern int (CDECL *mono_jit_exec)(MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]);
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);
@ -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 MonoString* (CDECL *mono_string_new)(MonoDomain *domain, const char *str);
extern MonoThread* (CDECL *mono_thread_attach)(MonoDomain *domain);
extern void (CDECL *mono_thread_manage)(void);
extern void (CDECL *mono_trace_set_assembly)(MonoAssembly *assembly);
/* loaded runtime interfaces */