[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 10/17: Mutex instead of critical section in GOOPS
From: |
Andy Wingo |
Subject: |
[Guile-commits] 10/17: Mutex instead of critical section in GOOPS |
Date: |
Tue, 1 Nov 2016 22:50:44 +0000 (UTC) |
wingo pushed a commit to branch master
in repository guile.
commit e7e7a719bace8b71b351b9305940a7b4a724cc81
Author: Andy Wingo <address@hidden>
Date: Tue Nov 1 22:52:12 2016 +0100
Mutex instead of critical section in GOOPS
* libguile/goops.c (scm_sys_modify_instance)
(scm_sys_modify_class): Use a mutex instead of a critical section.
---
libguile/goops.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/libguile/goops.c b/libguile/goops.c
index 4e28d06..8ed0f60 100644
--- a/libguile/goops.c
+++ b/libguile/goops.c
@@ -475,6 +475,8 @@ SCM_DEFINE (scm_sys_clear_fields_x, "%clear-fields!", 2, 0,
0,
+static scm_i_pthread_mutex_t goops_lock = SCM_I_PTHREAD_MUTEX_INITIALIZER;
+
SCM_DEFINE (scm_sys_modify_instance, "%modify-instance", 2, 0, 0,
(SCM old, SCM new),
"Used by change-class to modify objects in place.")
@@ -487,7 +489,7 @@ SCM_DEFINE (scm_sys_modify_instance, "%modify-instance", 2,
0, 0,
* scratch the old value with new to be correct with GC.
* See "Class redefinition protocol above".
*/
- SCM_CRITICAL_SECTION_START;
+ scm_i_pthread_mutex_lock (&goops_lock);
{
scm_t_bits word0, word1;
word0 = SCM_CELL_WORD_0 (old);
@@ -497,7 +499,7 @@ SCM_DEFINE (scm_sys_modify_instance, "%modify-instance", 2,
0, 0,
SCM_SET_CELL_WORD_0 (new, word0);
SCM_SET_CELL_WORD_1 (new, word1);
}
- SCM_CRITICAL_SECTION_END;
+ scm_i_pthread_mutex_unlock (&goops_lock);
return SCM_UNSPECIFIED;
}
#undef FUNC_NAME
@@ -510,7 +512,7 @@ SCM_DEFINE (scm_sys_modify_class, "%modify-class", 2, 0, 0,
SCM_VALIDATE_CLASS (1, old);
SCM_VALIDATE_CLASS (2, new);
- SCM_CRITICAL_SECTION_START;
+ scm_i_pthread_mutex_lock (&goops_lock);
{
scm_t_bits word0, word1;
word0 = SCM_CELL_WORD_0 (old);
@@ -522,7 +524,7 @@ SCM_DEFINE (scm_sys_modify_class, "%modify-class", 2, 0, 0,
SCM_SET_CELL_WORD_1 (new, word1);
SCM_STRUCT_DATA (new)[scm_vtable_index_self] = SCM_UNPACK (new);
}
- SCM_CRITICAL_SECTION_END;
+ scm_i_pthread_mutex_unlock (&goops_lock);
return SCM_UNSPECIFIED;
}
#undef FUNC_NAME
- [Guile-commits] 13/17: Mutex in dynamic linker, (continued)
- [Guile-commits] 13/17: Mutex in dynamic linker, Andy Wingo, 2016/11/01
- [Guile-commits] 11/17: Mutex instead of critical section in gc.c, Andy Wingo, 2016/11/01
- [Guile-commits] 16/17: Threads no longer track critical section level, Andy Wingo, 2016/11/01
- [Guile-commits] 03/17: threads: Use a mutex instead of a critical section., Andy Wingo, 2016/11/01
- [Guile-commits] 07/17: Mutexes instead of critical sections in stime.c, Andy Wingo, 2016/11/01
- [Guile-commits] 01/17: api-scheduling.texi: Syntactic cleanups., Andy Wingo, 2016/11/01
- [Guile-commits] 08/17: Mutex instead of critical sectoin in symbol->keyword, Andy Wingo, 2016/11/01
- [Guile-commits] 05/17: regexec comment fix, Andy Wingo, 2016/11/01
- [Guile-commits] 15/17: Remove call/cc assertion about critical sections, Andy Wingo, 2016/11/01
- [Guile-commits] 09/17: Simplify critical section implementation, Andy Wingo, 2016/11/01
- [Guile-commits] 10/17: Mutex instead of critical section in GOOPS,
Andy Wingo <=
- [Guile-commits] 02/17: Add scm_yield to manual alongside yield, Andy Wingo, 2016/11/01
- [Guile-commits] 12/17: Remove critical section in scm_debug_options, Andy Wingo, 2016/11/01
- [Guile-commits] 14/17: Remove last critical section use, Andy Wingo, 2016/11/01
- [Guile-commits] 17/17: Deprecate critical sections, Andy Wingo, 2016/11/01