Author: gonzalo
Date: 2005-04-27 19:54:50 -0400 (Wed, 27 Apr 2005)
New Revision: 43700
Modified:
trunk/mono/mono/metadata/ChangeLog
trunk/mono/mono/metadata/threads.c
Log:
2005-04-27 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
* threads.c: don't wait for threads that are in the process of aborting
or aborted. Set the 'shutting_down' flag before cleaning the threadpool
and waiting for background threads to finish. This makes xsp and
mod-mono-server exit without random length delays and/or hangs.
Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog 2005-04-27 23:49:39 UTC (rev 43699)
+++ trunk/mono/mono/metadata/ChangeLog 2005-04-27 23:54:50 UTC (rev 43700)
@@ -1,5 +1,12 @@
2005-04-27 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+ * threads.c: don't wait for threads that are in the process of aborting
+ or aborted. Set the 'shutting_down' flag before cleaning the threadpool
+ and waiting for background threads to finish. This makes xsp and
+ mod-mono-server exit without random length delays and/or hangs.
+
+2005-04-27 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
* icall.c: remove duplicate assignment from GetReferencedAssemblies.
2005-04-25 Zoltan Varga <[EMAIL PROTECTED]>
Modified: trunk/mono/mono/metadata/threads.c
===================================================================
--- trunk/mono/mono/metadata/threads.c 2005-04-27 23:49:39 UTC (rev 43699)
+++ trunk/mono/mono/metadata/threads.c 2005-04-27 23:54:50 UTC (rev 43700)
@@ -1688,22 +1688,22 @@
HANDLE handle;
/* The finalizer thread is not a background thread */
- if (thread->tid != self && thread->state & ThreadState_Background) {
+ if (thread->tid != self && (thread->state & ThreadState_Background) !=
0) {
handle = OpenThread (THREAD_ALL_ACCESS, TRUE, thread->tid);
if (handle == NULL)
return FALSE;
- wait->handles[wait->num]=thread->handle;
- wait->threads[wait->num]=thread;
- wait->num++;
-
if(thread->state & ThreadState_AbortRequested ||
thread->state & ThreadState_Aborted) {
THREAD_DEBUG (g_message (G_GNUC_PRETTY_FUNCTION ":
Thread id %d already aborting", thread->tid));
return(TRUE);
}
-
+
+ wait->handles[wait->num]=thread->handle;
+ wait->threads[wait->num]=thread;
+ wait->num++;
+
THREAD_DEBUG (g_print (G_GNUC_PRETTY_FUNCTION ": Aborting id:
%d\n", thread->tid));
mono_thread_stop (thread);
return TRUE;
@@ -1740,8 +1740,12 @@
/* Something to wait for */
wait_for_tids (wait, INFINITE);
}
+ THREAD_DEBUG (g_message ("I have %d threads after waiting.",
wait->num));
} while(wait->num>0);
-
+
+ mono_runtime_set_shutting_down ();
+
+ THREAD_DEBUG (g_message ("threadpool cleanup"));
mono_thread_pool_cleanup ();
EnterCriticalSection(&threads_mutex);
@@ -1755,6 +1759,7 @@
LeaveCriticalSection(&threads_mutex);
+ THREAD_DEBUG (g_message ("wait->num is now %d", wait->num));
if(wait->num>0) {
/* Something to wait for */
wait_for_tids (wait, INFINITE);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches