From 5c109a17584d2a2d2126faabb0db2979635365dc Mon Sep 17 00:00:00 2001 From: Benjamin Kosnik Date: Thu, 2 Oct 2003 19:02:58 +0000 Subject: [PATCH] locale.cc (locale::_S_initialize): Use __gthread_active_p. 2003-10-02 Benjamin Kosnik * src/locale.cc (locale::_S_initialize): Use __gthread_active_p. (locale::facet::_S_get_c_locale): Same. From-SVN: r72045 --- libstdc++-v3/ChangeLog | 5 +++++ libstdc++-v3/src/locale.cc | 22 ++++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 59b6bffa2da..7224004a186 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2003-10-02 Benjamin Kosnik + + * src/locale.cc (locale::_S_initialize): Use __gthread_active_p. + (locale::facet::_S_get_c_locale): Same. + 2003-10-02 Benjamin Kosnik * config/linker-map.gnu: Export _S_get_c_locale instead of diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc index b37b30c43c2..1ba83d1ae9b 100644 --- a/libstdc++-v3/src/locale.cc +++ b/libstdc++-v3/src/locale.cc @@ -385,11 +385,14 @@ namespace std locale::_S_initialize() { #ifdef __GTHREADS - __gthread_once(&_S_once, _S_initialize_once); -#else - if (!_S_classic) - _S_initialize_once(); + if (__gthread_active_p()) + __gthread_once(&_S_once, _S_initialize_once); + else #endif + { + if (!_S_classic) + _S_initialize_once(); + } } void @@ -472,11 +475,14 @@ namespace std locale::facet::_S_get_c_locale() { #ifdef __GHTREADS - __gthread_once(&_S_once, _S_initialize_once); -#else - if (!_S_c_locale) - _S_initialize_once(); + if (__gthread_active_p()) + __gthread_once(&_S_once, _S_initialize_once); + else #endif + { + if (!_S_c_locale) + _S_initialize_once(); + } return _S_c_locale; }