diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ad1fb5d5413..cb6c84cc9b8 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,55 @@ +2005-09-11 Benjamin Kosnik + + PR libstdc++/19265 + PR libstdc++/22309 + * include/ext/mt_allocator.h + (__gnu_cxx::__create_handler): Remove. + (__pool::_M_destroy_thread_key): Compatibility only. + (__pool::_M_initialize(__destroy): Same. + (__pool::_M_initialize): New. + (__pool::_M_initialize_once): Nothing fancy. + (__pool::_M_once): Remove. + (__common_pool): New. + (__common_pool_base): New. + (__per_type_pool): New. + (__per_type_pool_base): New. + * src/mt_allocator.cc: Same. + * config/linker-map.gnu (__pool::_M_initialize()): Add. + +2005-09-11 Jakub Jelinek + + PR libstdc++/19265 + PR libstdc++/22309 + * src/mt_allocator.cc (__gnu_internal::freelist_mutex): Make static. + (__gnu_internal::__freelist): New type. + (__gnu_internal::freelist): New variable. + (__gnu_internal::_M_destroy_thread_key): New function. + (__gnu_cxx::__pool::_M_destroy): Don't delete + _M_thread_freelist_initial. + (__gnu_cxx::__pool::_M_initialize): Make argument nameless. + Don't use _M_thread_freelist and _M_thread_freelist_initial + __pool fields, instead use __gnu_internal::freelist fields, call + gthread_key_create just once. Use + __gnu_internal::_M_destroy_thread_key as key destructor. + (__gnu_cxx::__pool::_M_get_thread_id): Store size_t id + rather than _Thread_record* in the thread specific value. Don't + use _M_thread_freelist __pool field, instead use + __gnu_internal::freelist fields. + (__gnu_cxx::__pool::_M_destroy_thread_key): Do nothing. + +2005-09-11 Benjamin Kosnik + Jakub Jelinek + + PR libstdc++/19265 + PR libstdc++/22309 + * testsuite/testsuite_shared.cc: New. + * testsuite/lib/dg-options.exp (dg-require-sharedlib): New. + * testsuite/lib/libstdc++.exp (libstdc++_init): Look for shared + library, and set v3-sharedlib based on this. + (check_v3_target_sharedlib): New. + (proc v3-build_support): Build shared objects. + * testsuite/ext/mt_allocator/22309_thread.cc: New, use above. + 2005-09-11 Paolo Carlini PR libstdc++/23781 diff --git a/libstdc++-v3/config/linker-map.gnu b/libstdc++-v3/config/linker-map.gnu index 3099bfb6817..eb8fab60c4c 100644 --- a/libstdc++-v3/config/linker-map.gnu +++ b/libstdc++-v3/config/linker-map.gnu @@ -515,8 +515,8 @@ GLIBCXX_3.4.3 { } GLIBCXX_3.4.2; GLIBCXX_3.4.4 { - - _ZN9__gnu_cxx6__poolILb0EE13_M_initializeEv; + + _ZN9__gnu_cxx6__poolILb0EE13_M_initializeEv; _ZN9__gnu_cxx6__poolILb1EE13_M_initializeEPFvPvE; _ZN9__gnu_cxx6__poolILb1EE21_M_destroy_thread_keyEPv; _ZN9__gnu_cxx6__poolILb1EE16_M_get_thread_idEv; @@ -571,6 +571,8 @@ GLIBCXX_3.4.6 { _ZNKSt15basic_stringbufIwSt11char_traitsIwESaIwEE3strEv; + _ZN9__gnu_cxx6__poolILb1EE13_M_initializeEv; + } GLIBCXX_3.4.5; # Symbols in the support library (libsupc++) have their own tag. diff --git a/libstdc++-v3/include/ext/mt_allocator.h b/libstdc++-v3/include/ext/mt_allocator.h index b2cf89b562c..311e219aaee 100644 --- a/libstdc++-v3/include/ext/mt_allocator.h +++ b/libstdc++-v3/include/ext/mt_allocator.h @@ -43,7 +43,6 @@ namespace __gnu_cxx { typedef void (*__destroy_handler)(void*); - typedef void (*__create_handler)(void); /// @brief Base class for pool object. struct __pool_base @@ -185,12 +184,6 @@ namespace __gnu_cxx template class __pool; - template<> - class __pool; - - template<> - class __pool; - /// Specialization for single thread. template<> class __pool : public __pool_base @@ -313,24 +306,15 @@ namespace __gnu_cxx __gthread_mutex_t* _M_mutex; }; + // XXX GLIBCXX_ABI Deprecated void - _M_initialize(__destroy_handler __d); + _M_initialize(__destroy_handler); void - _M_initialize_once(__create_handler __c) + _M_initialize_once() { - // Although the test in __gthread_once() would suffice, we - // wrap test of the once condition in our own unlocked - // check. This saves one function call to pthread_once() - // (which itself only tests for the once value unlocked anyway - // and immediately returns if set) if (__builtin_expect(_M_init == false, false)) - { - if (__gthread_active_p()) - __gthread_once(&_M_once, __c); - if (!_M_init) - __c(); - } + _M_initialize(); } void @@ -358,28 +342,21 @@ namespace __gnu_cxx } } + // XXX GLIBCXX_ABI Deprecated void - _M_destroy_thread_key(void* __freelist_pos); + _M_destroy_thread_key(void*); size_t _M_get_thread_id(); explicit __pool() : _M_bin(NULL), _M_bin_size(1), _M_thread_freelist(NULL) - { - // On some platforms, __gthread_once_t is an aggregate. - __gthread_once_t __tmp = __GTHREAD_ONCE_INIT; - _M_once = __tmp; - } + { } explicit __pool(const __pool_base::_Tune& __tune) : __pool_base(__tune), _M_bin(NULL), _M_bin_size(1), _M_thread_freelist(NULL) - { - // On some platforms, __gthread_once_t is an aggregate. - __gthread_once_t __tmp = __GTHREAD_ONCE_INIT; - _M_once = __tmp; - } + { } private: // An "array" of bin_records each of which represents a specific @@ -390,39 +367,131 @@ namespace __gnu_cxx // Actual value calculated in _M_initialize(). size_t _M_bin_size; - __gthread_once_t _M_once; - _Thread_record* _M_thread_freelist; void* _M_thread_freelist_initial; + + void + _M_initialize(); }; #endif + template