From 1eb49526935408350e08c25c328b4088eb9865d3 Mon Sep 17 00:00:00 2001 From: Julian Graham Date: Sat, 6 Sep 2008 20:06:17 -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=UTF-8 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 5550b7a65..75cd28389 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,8 @@ +2008-09-06 Julian Graham + + * threads.c (fat_mutex_lock): Resolve a deadlock caused by not + checking mutex state after calling `SCM_TICK'. + 2008-08-20 Ludovic Courtès * eval.c, filesys.c, gc.c, numbers.c, posix.c, srfi-14.c, diff --git a/libguile/threads.c b/libguile/threads.c index 843dfca07..dede85e28 100644 --- a/libguile/threads.c +++ b/libguile/threads.c @@ -1030,9 +1030,9 @@ fat_mutex_lock (SCM mutex) { while (1) { - block_self (m->waiting, mutex, &m->lock, NULL); if (scm_is_eq (m->owner, thread)) break; + block_self (m->waiting, mutex, &m->lock, NULL); scm_i_pthread_mutex_unlock (&m->lock); SCM_TICK; scm_i_scm_pthread_mutex_lock (&m->lock);