=?koi8-r?Q?Re[2]=3A_[Gc]_On_cancellation, _GC=5Fthread=5Fexit=5Fproc_is_never_called?=

Ivan Maidanski ivmai at mail.ru
Thu Apr 1 10:34:46 PST 2010


Wed, 31 Mar 2010 10:02:58 +0900 NIIBE Yutaka <gniibe at fsij.org>:

> Ivan Maidanski wrote:
> > Tue, 30 Mar 2010 13:48:08 +0900 NIIBE Yutaka <gniibe at fsij.org>:
> >
> > If this is a GCC-specific issue then, I think, "&& defined(__GNUC__)" should be added to the patch.
> [...]
> >>     In case of -fexceptions, __cleanup__ attribute is used and it is
> >>     recorded in the .eh_frame section.
> >>     Without option of -fexceptions, it is registered by
> >>     __pthread_register_cancel.


Hans -

Any comments? (Does it look ok to apply?)

> Yes, this is a GCC specific issue.  In pthread.h, we see:
> 
> 	#if defined __GNUC__ && defined __EXCEPTIONS
> 
> for pthread_cleanup_push with __cleanup__ attribute.
> 
> That is, the problem of never called GC_thread_exit_proc occurs
> only if gcc -fexceptions is used.
> 
> So, here is second try which has better ifdef condition with __GNUC__.
> 
> 
> Index: include/gc_config_macros.h
> ===================================================================
> RCS file: /cvsroot/bdwgc/bdwgc/include/gc_config_macros.h,v
> retrieving revision 1.22
> diff -u -r1.22 gc_config_macros.h
> --- include/gc_config_macros.h	20 Oct 2009 21:27:26 -0000	1.22
> +++ include/gc_config_macros.h	31 Mar 2010 00:57:58 -0000
> @@ -139,6 +139,20 @@
>  # define _REENTRANT
>  #endif
> 
> +# if defined(__GNUC__) && defined(GC_LINUX_THREADS)
> +  /* We undefine __EXCEPTIONS to avoid using __cleanup__ attribute of GCC.   */
> +  /*                                                                         */
> +  /* NPTL implementation of pthread_cleanup_push uses __cleanup__ attribute  */
> +  /* when __EXCEPTIONS is defined (-fexceptions).                            */
> +  /* Stack unwinding and cleanup with __cleanup__ attributes works correctly */
> +  /* when everything is compiled with -fexceptions, but it is not the        */
> +  /* requirement for this library users to use -fexceptions everywhere.      */
> +  /*                                                                         */
> +  /* With __EXCEPTIONS undefined, cleanup routines are registered with       */
> +  /* __pthread_register_cancel, which works any cases.                       */
> +# undef __EXCEPTIONS
> +# endif
> +
>  #define __GC
>  #if !defined(_WIN32_WCE) || defined(__GNUC__)
>  # include <stddef.h>
> -- 
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
> 



More information about the Gc mailing list