http://bugs.winehq.org/show_bug.cgi?id=30864
--- Comment #2 from Ivan Voyager vgr.subscription@gmail.com 2012-06-08 03:10:48 CDT --- Mono source: https://github.com/mono/mono
In appdomain.c I found function "mono_domain_try_unload" with potential reason of hang up:
/*The managed callback finished successfully, now we start tearing down the appdomain*/ domain->state = MONO_APPDOMAIN_UNLOADING; /* * First we create a separate thread for unloading, since * we might have to abort some threads, including the current one. */ /* * If we create a non-suspended thread, the runtime will hang. * See: * http://bugzilla.ximian.com/show_bug.cgi?id=27663 */ #if 0 thread_handle = mono_create_thread (NULL, 0, unload_thread_main, &thread_data, 0, &tid); #else thread_handle = mono_create_thread (NULL, 0, (LPTHREAD_START_ROUTINE)unload_thread_main, &thread_data, CREATE_SUSPENDED, &tid); if (thread_handle == NULL) { return; } ResumeThread (thread_handle); #endif
/* Wait for the thread */ while ((res = WaitForSingleObjectEx (thread_handle, INFINITE, TRUE) == WAIT_IO_COMPLETION)) { if (mono_thread_internal_has_appdomain_ref (mono_thread_internal_current (), domain) && (mono_thread_interruption_requested ())) { /* The unload thread tries to abort us */ /* The icall wrapper will execute the abort */ CloseHandle (thread_handle); return; } } CloseHandle (thread_handle);
Maybe it will be helpful?