diff options
author | Benjamin Kosnik <bkoz@redhat.com> | 2005-04-15 04:07:45 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2005-04-15 04:07:45 +0000 |
commit | 57b11c96547894d67972735a5df66fb9c7fdacdb (patch) | |
tree | e814221dcdb3e6d318e0d5fc623dde07c2085b80 /libstdc++-v3/src/bitmap_allocator.cc | |
parent | 25cd19de2f36ed2fce8aa2e9b8903591352b77a3 (diff) | |
download | gcc-57b11c96547894d67972735a5df66fb9c7fdacdb.zip gcc-57b11c96547894d67972735a5df66fb9c7fdacdb.tar.gz gcc-57b11c96547894d67972735a5df66fb9c7fdacdb.tar.bz2 |
2005-04-14 Benjamin Kosnik <bkoz@redhat.com>
* include/ext/bitmap_allocator.h
(__gnu_cxx::free_list::_M_get_mutex): New.
(__gnu_cxx::free_list::_M_get_free_list): New.
(__gnu_cxx::free_list::_S_bfl_mutex): Remove.
(__gnu_cxx::free_list::_S_free_list): Remove.
* src/bitmap_allocator.cc: Same.
* config/linker-map.gnu: Remove free_list and mutex export.
From-SVN: r98173
Diffstat (limited to 'libstdc++-v3/src/bitmap_allocator.cc')
-rw-r--r-- | libstdc++-v3/src/bitmap_allocator.cc | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/libstdc++-v3/src/bitmap_allocator.cc b/libstdc++-v3/src/bitmap_allocator.cc index c379664..c8d94af 100644 --- a/libstdc++-v3/src/bitmap_allocator.cc +++ b/libstdc++-v3/src/bitmap_allocator.cc @@ -48,25 +48,20 @@ namespace __gnu_cxx size_t const&, free_list::_LT_pointer_compare); } -#if defined __GTHREADS - _Mutex free_list::_S_bfl_mutex; -#endif - free_list::vector_type free_list::_S_free_list; - size_t* free_list:: _M_get(size_t __sz) throw(std::bad_alloc) { #if defined __GTHREADS - _Lock __bfl_lock(&_S_bfl_mutex); + _Lock __bfl_lock(_M_get_mutex()); __bfl_lock._M_lock(); #endif iterator __temp = __gnu_cxx::balloc::__lower_bound - (_S_free_list.begin(), _S_free_list.end(), + (_M_get_free_list().begin(), _M_get_free_list().end(), __sz, _LT_pointer_compare()); - if (__temp == _S_free_list.end() || !_M_should_i_give(**__temp, __sz)) + if (__temp == _M_get_free_list().end() || !_M_should_i_give(**__temp, __sz)) { // We release the lock here, because operator new is // guaranteed to be thread-safe by the underlying @@ -101,7 +96,7 @@ namespace __gnu_cxx else { size_t* __ret = *__temp; - _S_free_list.erase(__temp); + _M_get_free_list().erase(__temp); #if defined __GTHREADS __bfl_lock._M_unlock(); #endif @@ -114,15 +109,16 @@ namespace __gnu_cxx _M_clear() { #if defined __GTHREADS - _Auto_Lock __bfl_lock(&_S_bfl_mutex); + _Auto_Lock __bfl_lock(_M_get_mutex()); #endif - iterator __iter = _S_free_list.begin(); - while (__iter != _S_free_list.end()) + vector_type& __free_list = _M_get_free_list(); + iterator __iter = __free_list.begin(); + while (__iter != __free_list.end()) { ::operator delete((void*)*__iter); ++__iter; } - _S_free_list.clear(); + __free_list.clear(); } // Instantiations. |