1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 14:00:21 +02:00

Revert "Fix lock ordering in fat_mutex_lock' to match that of do_thread_exit'."

This reverts commit ccb80964cd, which
introduced a race condition, with a small window during which a mutex
could be held by a thread without being part of its `mutexes' list,
thereby violating the invariant tested at line 667.
This commit is contained in:
Ludovic Courtès 2011-07-01 22:43:01 +02:00
parent 231c0e0e61
commit 4f39f31ea5

View file

@ -1370,7 +1370,9 @@ fat_mutex_lock (SCM mutex, scm_t_timespec *timeout, SCM owner, int *ret)
{
scm_i_thread *t = SCM_I_THREAD_DATA (new_owner);
scm_i_pthread_mutex_unlock (&m->lock);
/* FIXME: The order in which `t->admin_mutex' and
`m->lock' are taken differs from that in
`on_thread_exit', potentially leading to deadlocks. */
scm_i_pthread_mutex_lock (&t->admin_mutex);
/* Only keep a weak reference to MUTEX so that it's not
@ -1381,7 +1383,6 @@ fat_mutex_lock (SCM mutex, scm_t_timespec *timeout, SCM owner, int *ret)
t->mutexes = scm_weak_car_pair (mutex, t->mutexes);
scm_i_pthread_mutex_unlock (&t->admin_mutex);
scm_i_pthread_mutex_lock (&m->lock);
}
*ret = 1;
break;