This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] fix thread init


Ouch. Turns out this is indeed necessary.

tested x86/linux

2003-10-02  Benjamin Kosnik  <bkoz@redhat.com>

	* src/locale.cc (locale::_S_initialize): Use __gthread_active_p.
	(locale::facet::_S_get_c_locale): Same.

Index: src/locale.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/locale.cc,v
retrieving revision 1.93
diff -c -p -r1.93 locale.cc
*** src/locale.cc	2 Oct 2003 16:56:39 -0000	1.93
--- src/locale.cc	2 Oct 2003 18:58:26 -0000
*************** namespace std 
*** 385,395 ****
    locale::_S_initialize()
    {
  #ifdef __GTHREADS
!     __gthread_once(&_S_once, _S_initialize_once);
! #else
!     if (!_S_classic)
!       _S_initialize_once();
  #endif
    }
  
    void
--- 385,398 ----
    locale::_S_initialize()
    {
  #ifdef __GTHREADS
!     if (__gthread_active_p())
!       __gthread_once(&_S_once, _S_initialize_once);
!     else
  #endif
+       {
+ 	if (!_S_classic)
+ 	  _S_initialize_once();
+       }
    }
  
    void
*************** namespace std 
*** 472,482 ****
    locale::facet::_S_get_c_locale()
    {
  #ifdef __GHTREADS
!     __gthread_once(&_S_once, _S_initialize_once);
! #else
!     if (!_S_c_locale)
!       _S_initialize_once();
  #endif
      return _S_c_locale;
    }
  
--- 475,488 ----
    locale::facet::_S_get_c_locale()
    {
  #ifdef __GHTREADS
!     if (__gthread_active_p())
!       __gthread_once(&_S_once, _S_initialize_once);
!     else
  #endif
+       {
+ 	if (!_S_c_locale)
+ 	  _S_initialize_once();
+       }
      return _S_c_locale;
    }
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]