aboutsummaryrefslogtreecommitdiff
path: root/boehm-gc/misc.c
diff options
context:
space:
mode:
authorBryce McKinlay <mckinlay@redhat.com>2006-08-21 22:07:30 +0000
committerTom Tromey <tromey@gcc.gnu.org>2006-08-21 22:07:30 +0000
commit7ddf92a8742e02a5873daaafa0b660bf4a4c1a01 (patch)
tree4c9de9e1ba2a27a47f6d8da1bbd87446fe43e48f /boehm-gc/misc.c
parentaccabadcf398fb27c0e13154b7d2d1d52fc4fdef (diff)
downloadgcc-7ddf92a8742e02a5873daaafa0b660bf4a4c1a01.zip
gcc-7ddf92a8742e02a5873daaafa0b660bf4a4c1a01.tar.gz
gcc-7ddf92a8742e02a5873daaafa0b660bf4a4c1a01.tar.bz2
re PR libgcj/13212 (JNI/CNI AttachCurrentThread does not register thread with garbage collector)
boehm-gc PR libgcj/13212: * configure.ac: Check for pthread_getattr_np(). Remove GC_PTHREAD_SYM_VERSION detection. * include/gc.h (GC_register_my_thread, GC_unregister_my_thread, GC_get_thread_stack_base): New declarations. * pthread_support.c (GC_register_my_thread, GC_unregister_my_thread, GC_get_thread_stack_base): New functions. (GC_delete_thread): Don't try to free the first_thread. * misc.c (GC_init_inner): Use GC_get_thread_stack_base() if possible. (pthread_create_, constr): Removed. (pthread_create): Don't rename. * include/gc_ext_config.h.in: Rebuilt. * include/gc_pthread_redirects.h (pthread_create): Define unconditionally. * include/gc_config.h.in: Rebuilt. * configure: Rebuilt. libjava * java/lang/natThread.cc (_Jv_AttachCurrentThread): Attach thread to GC. (_Jv_DetachCurrentThread): Detach thread from GC. * include/boehm-gc.h (_Jv_GCAttachThread, _Jv_GCDetachThread): Declare. * boehm.cc (_Jv_GCAttachThread): New function. (_Jv_GCDetachThread): Likewise. From-SVN: r116313
Diffstat (limited to 'boehm-gc/misc.c')
-rw-r--r--boehm-gc/misc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/boehm-gc/misc.c b/boehm-gc/misc.c
index 89f05ba..23e226d 100644
--- a/boehm-gc/misc.c
+++ b/boehm-gc/misc.c
@@ -674,7 +674,13 @@ void GC_init_inner()
# if !defined(THREADS) || defined(GC_PTHREADS) || defined(GC_WIN32_THREADS) \
|| defined(GC_SOLARIS_THREADS)
if (GC_stackbottom == 0) {
- GC_stackbottom = GC_get_stack_base();
+ # ifdef GC_PTHREADS
+ /* Use thread_stack_base if available, as GC could be initialized from
+ a thread that is not the "main" thread. */
+ GC_stackbottom = GC_get_thread_stack_base();
+ # endif
+ if (GC_stackbottom == 0)
+ GC_stackbottom = GC_get_stack_base();
# if (defined(LINUX) || defined(HPUX)) && defined(IA64)
GC_register_stackbottom = GC_get_register_stack_base();
# endif