summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtes <ludo@gnu.org>2007-10-21 18:53:32 +0000
committerLudovic Courtès <ludo@gnu.org>2008-09-10 22:52:10 +0200
commit35747a3e063ae0dd2e8828c680a76e8589d7b8c7 (patch)
tree19c2c6627601eee9f559fcb72701583225dbb34f
parent071e0d93299d49158c737069597c7a74265628d8 (diff)
downloadguile-35747a3e063ae0dd2e8828c680a76e8589d7b8c7.tar.gz
Add comment about `GC_local_malloc ()' upon thread destruction.
* libguile/threads.c (on_thread_exit): Add caveat about possible segfault. git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-8
-rw-r--r--libguile/threads.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libguile/threads.c b/libguile/threads.c
index a26e344c8..02e6948b2 100644
--- a/libguile/threads.c
+++ b/libguile/threads.c
@@ -512,6 +512,17 @@ on_thread_exit (void *v)
/* Unblocking the joining threads needs to happen in guile mode
since the queue is a SCM data structure. */
+
+ /* Note: `scm_with_guile ()' invokes `GC_local_malloc ()', which accesses
+ thread-local storage (TLS). If said storage is accessed using
+ `pthread_getspecific ()', then it may be inaccessible at this point,
+ having been destroyed earlier, since the invocation order of destructors
+ associated with pthread keys is unspecified:
+
+ http://www.opengroup.org/onlinepubs/009695399/functions/pthread_key_create.html
+
+ Thus, `libgc' *must* be compiled with `USE_COMPILER_TLS' for this code
+ to work. */
scm_with_guile (do_thread_exit, v);
/* Removing ourself from the list of all threads needs to happen in