]> granicus.if.org Git - gc/commit
Support GC_init (and get_stack_base) from non-main thread on FreeBSD
authorIvan Maidanski <ivmai@mail.ru>
Wed, 27 Sep 2017 23:06:31 +0000 (02:06 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 27 Sep 2017 23:06:31 +0000 (02:06 +0300)
commit49d7fe77033f0bdabd50a2912cd58effd85452c1
tree0b4a6408f5d000fbdc140e7f9b06b539599aed22
parentc2ded73d56acc85270afea8b16221ac262486e6b
Support GC_init (and get_stack_base) from non-main thread on FreeBSD

Issue #180 (bdwgc).

Now GC_get_[main_]stack_base uses pthread_attr_get_np() and
pthread_attr_getstack() to determine the stack base address.

* os_dep.c [FREEBSD && !NO_PTHREAD_ATTR_GET_NP && (THREADS
|| USE_GET_STACKBASE_FOR_MAIN)]: Include pthread.h and pthread_np.h.
* os_dep.c [FREEBSD && !NO_PTHREAD_ATTR_GET_NP
&& (USE_GET_STACKBASE_FOR_MAIN || THREADS && !REDIRECT_MALLOC)]
(GC_get_main_stack_base): Call pthread_attr_init, pthread_attr_get_np
and pthread_attr_getstack to determine the stack base address of the
current thread (fall back to GC_freebsd_main_stack_base in case of
failure).
* os_dep.c [(GC_FREEBSD_THREADS && !NO_PTHREAD_ATTR_GET_NP]
(GC_get_stack_base): Call pthread_attr_init, pthread_attr_get_np and
pthread_attr_getstack to determine the stack base address of the
current thread.
os_dep.c