From 33b8ea2a147a3bf8f4617b0399cbb2b2dbbb6f9e Mon Sep 17 00:00:00 2001 From: tromey Date: Mon, 21 Aug 2006 22:07:30 +0000 Subject: 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116313 138bc75d-0d04-0410-961f-82ee72b054a4 --- boehm-gc/include/gc.h | 20 +++++++++++++++++++- boehm-gc/include/gc_config.h.in | 6 +++--- boehm-gc/include/gc_ext_config.h.in | 2 +- boehm-gc/include/gc_pthread_redirects.h | 2 -- 4 files changed, 23 insertions(+), 7 deletions(-) (limited to 'boehm-gc/include') diff --git a/boehm-gc/include/gc.h b/boehm-gc/include/gc.h index e6ab2c608c4..5ba1f4becfe 100644 --- a/boehm-gc/include/gc.h +++ b/boehm-gc/include/gc.h @@ -69,7 +69,6 @@ extern "C" { # endif - /* Define word and signed_word to be unsigned and signed types of the */ /* size as char * or void *. There seems to be no way to do this */ /* even semi-portably. The following is probably no better/worse */ @@ -912,6 +911,25 @@ GC_API void (*GC_is_visible_print_proc) # if defined(PCR) || defined(GC_SOLARIS_THREADS) || \ defined(GC_PTHREADS) || defined(GC_WIN32_THREADS) /* Any flavor of threads except SRC_M3. */ + +/* Register the current thread as a new thread whose stack(s) should */ +/* be traced by the GC. */ +/* If a platform does not implicitly do so, this must be called before */ +/* a thread can allocate garbage collected memory, or assign pointers */ +/* to the garbage collected heap. Once registered, a thread will be */ +/* stopped during garbage collections. */ +GC_API void GC_register_my_thread GC_PROTO((void)); + +/* Register the current thread, with the indicated stack base, as */ +/* a new thread whose stack(s) should be traced by the GC. If a */ +/* platform does not implicitly do so, this must be called before a */ +/* thread can allocate garbage collected memory, or assign pointers */ +/* to the garbage collected heap. Once registered, a thread will be */ +/* stopped during garbage collections. */ +GC_API void GC_unregister_my_thread GC_PROTO((void)); + +GC_API GC_PTR GC_get_thread_stack_base GC_PROTO((void)); + /* This returns a list of objects, linked through their first */ /* word. Its use can greatly reduce lock contention problems, since */ /* the allocation lock can be acquired and released many fewer times. */ diff --git a/boehm-gc/include/gc_config.h.in b/boehm-gc/include/gc_config.h.in index 401de609ba6..5055b502459 100644 --- a/boehm-gc/include/gc_config.h.in +++ b/boehm-gc/include/gc_config.h.in @@ -45,9 +45,6 @@ /* support for Tru64 pthreads */ #undef GC_OSF1_THREADS -/* symbol version of pthread_create */ -#undef GC_PTHREAD_SYM_VERSION - /* support for Solaris pthreads */ #undef GC_SOLARIS_PTHREADS @@ -81,6 +78,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the `pthread_getattr_np' function. */ +#undef HAVE_PTHREAD_GETATTR_NP + /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H diff --git a/boehm-gc/include/gc_ext_config.h.in b/boehm-gc/include/gc_ext_config.h.in index 716143dc62f..219ba2fb8c8 100644 --- a/boehm-gc/include/gc_ext_config.h.in +++ b/boehm-gc/include/gc_ext_config.h.in @@ -4,4 +4,4 @@ is used by libjava/include/boehm-gc.h. */ #undef THREAD_LOCAL_ALLOC -#undef GC_PTHREAD_SYM_VERSION +#undef HAVE_PTHREAD_GETATTR_NP diff --git a/boehm-gc/include/gc_pthread_redirects.h b/boehm-gc/include/gc_pthread_redirects.h index f9d4939affc..842518cfcc4 100644 --- a/boehm-gc/include/gc_pthread_redirects.h +++ b/boehm-gc/include/gc_pthread_redirects.h @@ -68,9 +68,7 @@ # undef pthread_detach #endif -#ifndef GC_PTHREAD_SYM_VERSION # define pthread_create GC_pthread_create -#endif # define pthread_join GC_pthread_join # define pthread_detach GC_pthread_detach -- cgit v1.2.1