diff options
Diffstat (limited to 'libguile')
-rw-r--r-- | libguile/threads.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libguile/threads.c b/libguile/threads.c index f71c83c5a..9a6e4061c 100644 --- a/libguile/threads.c +++ b/libguile/threads.c @@ -38,6 +38,10 @@ #include <sys/time.h> #endif +#if HAVE_PTHREAD_NP_H +# include <pthread_np.h> +#endif + #include <assert.h> #include <fcntl.h> #include <nproc.h> @@ -141,6 +145,29 @@ get_thread_stack_base () return pthread_get_stackaddr_np (pthread_self ()); } +#elif HAVE_PTHREAD_ATTR_GET_NP +/* This one is for FreeBSD 9. */ +static void * +get_thread_stack_base () +{ + pthread_attr_t attr; + void *start, *end; + size_t size; + + pthread_attr_init (&attr); + pthread_attr_get_np (pthread_self (), &attr); + pthread_attr_getstack (&attr, &start, &size); + pthread_attr_destroy (&attr); + + end = (char *)start + size; + +#if SCM_STACK_GROWS_UP + return start; +#else + return end; +#endif +} + #else #error Threads enabled with old BDW-GC, but missing get_thread_stack_base impl. Please upgrade to libgc >= 7.1. #endif |