2007-04-28 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Sat, 28 Apr 2007 20:50:57 +0000 (20:50 -0000)
committerZoltan Varga <vargaz@gmail.com>
Sat, 28 Apr 2007 20:50:57 +0000 (20:50 -0000)
* threads.c (build_wait_tids): Do not call mono_monitor_enter () here since the
caller holds threads_lock, leading to deadlocks. Fixes #81476.

svn path=/trunk/mono/; revision=76437

mono/metadata/ChangeLog
mono/metadata/threads.c

index d8f1fe82aa767014a2f80acdd8ca4ba3949308a0..90342273984ca4a5dbc932c64203100fdeeceadc 100644 (file)
@@ -1,3 +1,8 @@
+2007-04-28  Zoltan Varga  <vargaz@gmail.com>
+
+       * threads.c (build_wait_tids): Do not call mono_monitor_enter () here since the
+       caller holds threads_lock, leading to deadlocks. Fixes #81476.
+
 2007-04-26  Zoltan Varga  <vargaz@gmail.com>
 
        * loader.c (mono_loader_error_prepare_exception): Fix crash caused by calling
index cbdce5c5a048a3038d7cd461e9d9958de6b4f0bf..733fe28fc845cbe34271dee495b07e44a4fca924 100644 (file)
@@ -2034,13 +2034,11 @@ static void build_wait_tids (gpointer key, gpointer value, gpointer user)
                MonoThread *thread=(MonoThread *)value;
 
                /* Ignore background threads, we abort them later */
-               mono_monitor_enter (thread->synch_lock);
+               /* Do not lock here since it is not needed and the caller holds threads_lock */
                if (thread->state & ThreadState_Background) {
                        THREAD_DEBUG (g_message ("%s: ignoring background thread %"G_GSIZE_FORMAT, __func__, (gsize)thread->tid));
-                       mono_monitor_exit (thread->synch_lock);
                        return; /* just leave, ignore */
                }
-               mono_monitor_exit (thread->synch_lock);
                
                if (mono_gc_is_finalizer_thread (thread)) {
                        THREAD_DEBUG (g_message ("%s: ignoring finalizer thread %"G_GSIZE_FORMAT, __func__, (gsize)thread->tid));