Resolve a deadlock caused by not checking mutex state after calling `SCM_TICK'.
authorJulian Graham <julian@countyhell.(none)>
Sat, 30 Aug 2008 23:03:21 +0000 (19:03 -0400)
committerLudovic Courtès <ludo@gnu.org>
Sun, 31 Aug 2008 19:17:18 +0000 (21:17 +0200)
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
libguile/ChangeLog
libguile/threads.c

index e8d9362..64229b2 100644 (file)
@@ -1,3 +1,8 @@
+2008-08-29  Julian Graham  <joolean@gmail.com>
+
+       * threads.c (fat_mutex_lock): Resolve a deadlock caused by not
+       checking mutex state after calling `SCM_TICK'.
+
 2008-08-27  Ludovic Courtès  <ludo@gnu.org>
 
        Fix builds `--without-threads'.  Reported by Han-Wen Nienhuys
index 7e55f3b..8699fd0 100644 (file)
@@ -1292,11 +1292,11 @@ fat_mutex_lock (SCM mutex, scm_t_timespec *timeout, SCM owner, int *ret)
                  break;
                }
            }
+         block_self (m->waiting, mutex, &m->lock, timeout);
          scm_i_pthread_mutex_unlock (&m->lock);
          SCM_TICK;
          scm_i_scm_pthread_mutex_lock (&m->lock);
        }
-      block_self (m->waiting, mutex, &m->lock, timeout);
     }
   scm_i_pthread_mutex_unlock (&m->lock);
   return err;