mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 14:21:10 +02:00
Remove fat mutex abandoned mutex error
* libguile/threads.c (fat_mutex_lock): Remove abandoned mutex error, as SRFI-18 is responsible for this. * test-suite/tests/threads.test: Update test.
This commit is contained in:
parent
a3d0a7da4d
commit
f1b7eaaa1a
2 changed files with 4 additions and 20 deletions
|
@ -1131,8 +1131,6 @@ SCM_DEFINE (scm_make_recursive_mutex, "make-recursive-mutex", 0, 0, 0,
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
SCM_SYMBOL (scm_abandoned_mutex_error_key, "abandoned-mutex-error");
|
|
||||||
|
|
||||||
static SCM
|
static SCM
|
||||||
fat_mutex_lock (SCM mutex, scm_t_timespec *timeout, int *ret)
|
fat_mutex_lock (SCM mutex, scm_t_timespec *timeout, int *ret)
|
||||||
{
|
{
|
||||||
|
@ -1154,15 +1152,6 @@ fat_mutex_lock (SCM mutex, scm_t_timespec *timeout, int *ret)
|
||||||
*ret = 1;
|
*ret = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (SCM_I_IS_THREAD (m->owner) && scm_c_thread_exited_p (m->owner))
|
|
||||||
{
|
|
||||||
m->owner = new_owner;
|
|
||||||
err = scm_cons (scm_abandoned_mutex_error_key,
|
|
||||||
scm_from_locale_string ("lock obtained on abandoned "
|
|
||||||
"mutex"));
|
|
||||||
*ret = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (scm_is_eq (m->owner, new_owner))
|
else if (scm_is_eq (m->owner, new_owner))
|
||||||
{
|
{
|
||||||
if (m->recursive)
|
if (m->recursive)
|
||||||
|
|
|
@ -436,15 +436,10 @@
|
||||||
(lock-mutex m)
|
(lock-mutex m)
|
||||||
(lock-mutex m)))
|
(lock-mutex m)))
|
||||||
|
|
||||||
(pass-if "locking abandoned mutex throws exception"
|
(pass-if "abandoned mutexes are dead"
|
||||||
(let* ((m (make-mutex))
|
(let* ((m (make-mutex)))
|
||||||
(t (begin-thread (lock-mutex m)))
|
(join-thread (begin-thread (lock-mutex m)))
|
||||||
(success #f))
|
(not (lock-mutex m (+ (current-time) 0.1))))))))
|
||||||
(join-thread t)
|
|
||||||
(catch 'abandoned-mutex-error
|
|
||||||
(lambda () (lock-mutex m))
|
|
||||||
(lambda key (set! success #t)))
|
|
||||||
success)))))
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue