[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 04/08: Unlocked mutexes don't have owners
From: |
Andy Wingo |
Subject: |
[Guile-commits] 04/08: Unlocked mutexes don't have owners |
Date: |
Sun, 13 Nov 2016 14:58:54 +0000 (UTC) |
wingo pushed a commit to branch master
in repository guile.
commit 1ed9dea34aa8cb0cbae17200c31d1ac91a6a01de
Author: Andy Wingo <address@hidden>
Date: Sun Nov 13 12:43:46 2016 +0100
Unlocked mutexes don't have owners
* libguile/threads.c (scm_unlock_mutex)
(scm_timed_wait_condition_variable): Unlocked mutexes should never
have owners.
---
libguile/threads.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/libguile/threads.c b/libguile/threads.c
index 1c88796..863c84f 100644
--- a/libguile/threads.c
+++ b/libguile/threads.c
@@ -1268,8 +1268,11 @@ SCM_DEFINE (scm_unlock_mutex, "unlock-mutex", 1, 0, 0,
(SCM mutex),
if (m->level > 0)
m->level--;
if (m->level == 0)
- /* Change the owner of MUTEX. */
- m->owner = unblock_from_queue (m->waiting);
+ /* Wake up one waiter. */
+ {
+ m->owner = SCM_BOOL_F;
+ unblock_from_queue (m->waiting);
+ }
scm_i_pthread_mutex_unlock (&m->lock);
@@ -1414,8 +1417,11 @@ SCM_DEFINE (scm_timed_wait_condition_variable,
"wait-condition-variable", 2, 1,
if (m->level > 0)
m->level--;
if (m->level == 0)
- /* Change the owner of MUTEX. */
- m->owner = unblock_from_queue (m->waiting);
+ {
+ m->owner = SCM_BOOL_F;
+ /* Wake up one waiter. */
+ unblock_from_queue (m->waiting);
+ }
t->block_asyncs++;
- [Guile-commits] branch master updated (6bdd955 -> 9ac2c99), Andy Wingo, 2016/11/13
- [Guile-commits] 04/08: Unlocked mutexes don't have owners,
Andy Wingo <=
- [Guile-commits] 03/08: Put mutex kind in SMOB flags, Andy Wingo, 2016/11/13
- [Guile-commits] 07/08: Optimize lock-mutex, Andy Wingo, 2016/11/13
- [Guile-commits] 02/08: Rename Guile's internal mutexes and condvars, Andy Wingo, 2016/11/13
- [Guile-commits] 05/08: Refactor GC implications of thread sleep, Andy Wingo, 2016/11/13
- [Guile-commits] 06/08: Improve mutexes / condition variable implementation, Andy Wingo, 2016/11/13
- [Guile-commits] 01/08: Internal threads refactor, Andy Wingo, 2016/11/13
- [Guile-commits] 08/08: More comments in threads.c, Andy Wingo, 2016/11/13