summaryrefslogtreecommitdiff
path: root/libguile/struct.c
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2008-12-14 20:25:56 +0100
committerLudovic Courtès <ludo@gnu.org>2008-12-14 20:48:15 +0100
commit083f810fe9b7f04dc0de6b8ebc62053a41714f2b (patch)
treef36b397182a25292763bfad5bd14bdd69597327a /libguile/struct.c
parentc9d15b05833feccf1cbc644ab534b9beeaa5b744 (diff)
parent55aae983565cd14821d4cdff9f44afc96f8868c1 (diff)
downloadguile-083f810fe9b7f04dc0de6b8ebc62053a41714f2b.tar.gz
Merge branch 'master' into boehm-demers-weiser-gc
Conflicts: lib/Makefile.am libguile/struct.c libguile/threads.c m4/gnulib-cache.m4 m4/gnulib-comp.m4
Diffstat (limited to 'libguile/struct.c')
-rw-r--r--libguile/struct.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/libguile/struct.c b/libguile/struct.c
index afc0efa9a..b536bea3b 100644
--- a/libguile/struct.c
+++ b/libguile/struct.c
@@ -409,8 +409,14 @@ SCM_DEFINE (scm_make_struct, "make-struct", 2, 0, 1,
if (! SCM_LAYOUT_TAILP (SCM_CHAR (last_char)))
goto bad_tail;
}
-
- SCM_CRITICAL_SECTION_START;
+
+ /* In guile 1.8.5 and earlier, everything below was covered by a
+ CRITICAL_SECTION lock. This can lead to deadlocks in garbage
+ collection, since other threads might be holding the heap_mutex, while
+ sleeping on the CRITICAL_SECTION lock. There does not seem to be any
+ need for a lock on the section below, as it does not access or update
+ any globals, so the critical section has been removed. */
+
if (c_vtable[scm_struct_i_flags] & SCM_STRUCTF_ENTITY)
{
data = scm_alloc_struct (basic_size + tail_elts,
@@ -442,15 +448,6 @@ SCM_DEFINE (scm_make_struct, "make-struct", 2, 0, 1,
&prev_finalizer_data);
}
- SCM_CRITICAL_SECTION_END;
-
- /* In guile 1.8.1 and earlier, the SCM_CRITICAL_SECTION_END above covered
- also the following scm_struct_init. But that meant if scm_struct_init
- finds an invalid type for a "u" field then there's an error throw in a
- critical section, which results in an abort(). Not sure if we need any
- protection across scm_struct_init. The data array contains garbage at
- this point, but until we return it's not visible to anyone except
- `gc'. */
scm_struct_init (handle, layout, data, tail_elts, init);
return handle;