diff --git a/libguile/threads.c b/libguile/threads.c index 15e4919..417c225 100644 --- a/libguile/threads.c +++ b/libguile/threads.c @@ -1603,19 +1603,20 @@ fat_mutex_unlock (SCM mutex, SCM cond, if (! (SCM_UNBNDP (cond))) { c = SCM_CONDVAR_DATA (cond); + + if (m->level > 0) + m->level--; + if (m->level == 0) + { + /* Change the owner of MUTEX. */ + t->mutexes = scm_delq_x (mutex, t->mutexes); + m->owner = unblock_from_queue (m->waiting); + } + while (1) { int brk = 0; - if (m->level > 0) - m->level--; - if (m->level == 0) - { - /* Change the owner of MUTEX. */ - t->mutexes = scm_delq_x (mutex, t->mutexes); - m->owner = unblock_from_queue (m->waiting); - } - t->block_asyncs++; err = block_self (c->waiting, cond, &m->lock, waittime);