From 37a52039553b08c568e596852a871e59948ebfa6 Mon Sep 17 00:00:00 2001 From: Julian Graham Date: Sat, 30 Aug 2008 19:03:21 -0400 Subject: [PATCH] Resolve a deadlock caused by not checking mutex state after calling `SCM_TICK'. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Ludovic Courtès --- libguile/ChangeLog | 5 +++++ libguile/threads.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index e8d93628b..64229b235 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,8 @@ +2008-08-29 Julian Graham + + * threads.c (fat_mutex_lock): Resolve a deadlock caused by not + checking mutex state after calling `SCM_TICK'. + 2008-08-27 Ludovic Courtès Fix builds `--without-threads'. Reported by Han-Wen Nienhuys diff --git a/libguile/threads.c b/libguile/threads.c index 7e55f3b25..8699fd021 100644 --- a/libguile/threads.c +++ b/libguile/threads.c @@ -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; -- 2.20.1