summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Vollmer <mvo@zagadka.de>2006-03-25 22:24:21 +0000
committerMarius Vollmer <mvo@zagadka.de>2006-03-25 22:24:21 +0000
commit50a64877dd44883c29e75f4f1e1570777e2ba699 (patch)
tree164e068fb190fa5aa26547f137470d9e88f73239
parentd48f1dffa7d6e89c6b9af628c5d7ef0deba1ed27 (diff)
downloadguile-50a64877dd44883c29e75f4f1e1570777e2ba699.tar.gz
* threads.c (get_thread_stack_base): Use scm_get_stack_base
instead of accessing __libc_stack_end directly, and only do this when pthread_attr_getstack is known not to work for the main thread or when not using pthreads at all. * gc_os_dep.c (scm_get_stack_base): Abort when the machine type is unknown instead of returning NULL.
-rw-r--r--libguile/ChangeLog10
-rw-r--r--libguile/gc_os_dep.c1
-rw-r--r--libguile/threads.c22
3 files changed, 21 insertions, 12 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index 19d220d27..67a685d12 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -1,3 +1,13 @@
+2006-03-26 Marius Vollmer <mvo@zagadka.de>
+
+ * threads.c (get_thread_stack_base): Use scm_get_stack_base
+ instead of accessing __libc_stack_end directly, and only do this
+ when pthread_attr_getstack is known not to work for the main
+ thread or when not using pthreads at all.
+
+ * gc_os_dep.c (scm_get_stack_base): Abort when the machine type is
+ unknown instead of returning NULL.
+
2006-03-21 Ludovic Courtès <ludovic.courtes@laas.fr>
* numbers.c (scm_i_mem2number): Renamed to
diff --git a/libguile/gc_os_dep.c b/libguile/gc_os_dep.c
index 375ca87f0..a0e60e9d7 100644
--- a/libguile/gc_os_dep.c
+++ b/libguile/gc_os_dep.c
@@ -401,6 +401,7 @@ typedef int GC_bool;
void *
scm_get_stack_base ()
{
+ ABORT ("Can't determine stack base");
return NULL;
}
diff --git a/libguile/threads.c b/libguile/threads.c
index 7d25e4916..20b8e38c9 100644
--- a/libguile/threads.c
+++ b/libguile/threads.c
@@ -41,6 +41,7 @@
#include "libguile/iselect.h"
#include "libguile/fluids.h"
#include "libguile/continuations.h"
+#include "libguile/gc.h"
#include "libguile/init.h"
#ifdef __MINGW32__
@@ -564,10 +565,6 @@ scm_i_init_thread_for_guile (SCM_STACKITEM *base, SCM parent)
}
}
-#ifdef HAVE_LIBC_STACK_END
-
-extern void *__libc_stack_end;
-
#if SCM_USE_PTHREAD_THREADS
#ifdef HAVE_PTHREAD_ATTR_GETSTACK
@@ -580,18 +577,20 @@ get_thread_stack_base ()
void *start, *end;
size_t size;
- /* XXX - pthread_getattr_np from LinuxThreads does not seem to work
- for the main thread, but we can use __libc_stack_end in that
- case.
- */
-
pthread_getattr_np (pthread_self (), &attr);
pthread_attr_getstack (&attr, &start, &size);
end = (char *)start + size;
+ /* XXX - pthread_getattr_np from LinuxThreads does not seem to work
+ for the main thread, but we can use scm_get_stack_base in that
+ case.
+ */
+
+#ifndef PTHREAD_ATTR_GETSTACK_WORKS
if ((void *)&attr < start || (void *)&attr >= end)
- return __libc_stack_end;
+ return scm_get_stack_base ();
else
+#endif
{
#if SCM_STACK_GROWS_UP
return start;
@@ -610,11 +609,10 @@ get_thread_stack_base ()
static SCM_STACKITEM *
get_thread_stack_base ()
{
- return __libc_stack_end;
+ return scm_get_stack_base ();
}
#endif /* !SCM_USE_PTHREAD_THREADS */
-#endif /* HAVE_LIBC_STACK_END */
#ifdef HAVE_GET_THREAD_STACK_BASE