This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] fix thread init
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 2 Oct 2003 14:01:01 -0500
- Subject: [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;
}