Author: mprobst
Date: 2007-12-10 06:24:21 -0500 (Mon, 10 Dec 2007)
New Revision: 91040

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/gc.c
Log:
2007-12-10  Mark Probst  <[EMAIL PROTECTED]>

        * gc.c: Don't delay threadpool thread finalization unless Mono is
        shutting down.


Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2007-12-10 11:07:22 UTC (rev 91039)
+++ trunk/mono/mono/metadata/ChangeLog  2007-12-10 11:24:21 UTC (rev 91040)
@@ -1,4 +1,8 @@
+2007-12-10  Mark Probst  <[EMAIL PROTECTED]>
 
+       * gc.c: Don't delay threadpool thread finalization unless Mono is
+       shutting down.
+
 Mon Dec 10 11:06:23 CET 2007 Paolo Molaro <[EMAIL PROTECTED]>
 
        * threads.c: turn an assert into a non-fatal warning.

Modified: trunk/mono/mono/metadata/gc.c
===================================================================
--- trunk/mono/mono/metadata/gc.c       2007-12-10 11:07:22 UTC (rev 91039)
+++ trunk/mono/mono/metadata/gc.c       2007-12-10 11:24:21 UTC (rev 91040)
@@ -38,6 +38,8 @@
 
 static gboolean gc_disabled = FALSE;
 
+static gboolean finalizing_root_domain = FALSE;
+
 #define mono_finalizer_lock() EnterCriticalSection (&finalizer_mutex)
 #define mono_finalizer_unlock() LeaveCriticalSection (&finalizer_mutex)
 static CRITICAL_SECTION finalizer_mutex;
@@ -99,9 +101,10 @@
                        /* Avoid finalizing ourselves */
                        return;
 
-               if (t->threadpool_thread) {
-                       /* Don't finalize threadpool threads - they're
-                          finalized when the threadpool shuts down. */
+               if (t->threadpool_thread && finalizing_root_domain) {
+                       /* Don't finalize threadpool threads when
+                          shutting down - they're finalized when the
+                          threadpool shuts down. */
                        add_thread_to_finalize (t);
                        return;
                }
@@ -269,6 +272,9 @@
        req = g_new0 (DomainFinalizationReq, 1);
        req->domain = domain;
        req->done_event = done_event;
+
+       if (domain == mono_get_root_domain ())
+               finalizing_root_domain = TRUE;
        
        mono_finalizer_lock ();
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to