mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-22 20:40:29 +02:00
* 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.
This commit is contained in:
parent
d48f1dffa7
commit
50a64877dd
3 changed files with 21 additions and 12 deletions
|
@ -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>
|
2006-03-21 Ludovic Courtès <ludovic.courtes@laas.fr>
|
||||||
|
|
||||||
* numbers.c (scm_i_mem2number): Renamed to
|
* numbers.c (scm_i_mem2number): Renamed to
|
||||||
|
|
|
@ -401,6 +401,7 @@ typedef int GC_bool;
|
||||||
void *
|
void *
|
||||||
scm_get_stack_base ()
|
scm_get_stack_base ()
|
||||||
{
|
{
|
||||||
|
ABORT ("Can't determine stack base");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "libguile/iselect.h"
|
#include "libguile/iselect.h"
|
||||||
#include "libguile/fluids.h"
|
#include "libguile/fluids.h"
|
||||||
#include "libguile/continuations.h"
|
#include "libguile/continuations.h"
|
||||||
|
#include "libguile/gc.h"
|
||||||
#include "libguile/init.h"
|
#include "libguile/init.h"
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#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
|
#if SCM_USE_PTHREAD_THREADS
|
||||||
#ifdef HAVE_PTHREAD_ATTR_GETSTACK
|
#ifdef HAVE_PTHREAD_ATTR_GETSTACK
|
||||||
|
|
||||||
|
@ -580,18 +577,20 @@ get_thread_stack_base ()
|
||||||
void *start, *end;
|
void *start, *end;
|
||||||
size_t size;
|
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_getattr_np (pthread_self (), &attr);
|
||||||
pthread_attr_getstack (&attr, &start, &size);
|
pthread_attr_getstack (&attr, &start, &size);
|
||||||
end = (char *)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)
|
if ((void *)&attr < start || (void *)&attr >= end)
|
||||||
return __libc_stack_end;
|
return scm_get_stack_base ();
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
#if SCM_STACK_GROWS_UP
|
#if SCM_STACK_GROWS_UP
|
||||||
return start;
|
return start;
|
||||||
|
@ -610,11 +609,10 @@ get_thread_stack_base ()
|
||||||
static SCM_STACKITEM *
|
static SCM_STACKITEM *
|
||||||
get_thread_stack_base ()
|
get_thread_stack_base ()
|
||||||
{
|
{
|
||||||
return __libc_stack_end;
|
return scm_get_stack_base ();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !SCM_USE_PTHREAD_THREADS */
|
#endif /* !SCM_USE_PTHREAD_THREADS */
|
||||||
#endif /* HAVE_LIBC_STACK_END */
|
|
||||||
|
|
||||||
#ifdef HAVE_GET_THREAD_STACK_BASE
|
#ifdef HAVE_GET_THREAD_STACK_BASE
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue