aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@redhat.com>2005-04-15 04:07:45 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2005-04-15 04:07:45 +0000
commit57b11c96547894d67972735a5df66fb9c7fdacdb (patch)
treee814221dcdb3e6d318e0d5fc623dde07c2085b80 /libstdc++-v3/include
parent25cd19de2f36ed2fce8aa2e9b8903591352b77a3 (diff)
downloadgcc-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/include')
-rw-r--r--libstdc++-v3/include/ext/bitmap_allocator.h34
1 files changed, 23 insertions, 11 deletions
diff --git a/libstdc++-v3/include/ext/bitmap_allocator.h b/libstdc++-v3/include/ext/bitmap_allocator.h
index 9f02065..f607709 100644
--- a/libstdc++-v3/include/ext/bitmap_allocator.h
+++ b/libstdc++-v3/include/ext/bitmap_allocator.h
@@ -1,6 +1,6 @@
// Bitmap Allocator. -*- C++ -*-
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -717,10 +717,21 @@ namespace __gnu_cxx
{ return *__pui < __cui; }
};
-#if defined __GTHREADS
- static _Mutex _S_bfl_mutex;
+#if defined __GTHREADS
+ _Mutex*
+ _M_get_mutex()
+ {
+ static _Mutex _S_mutex;
+ return &_S_mutex;
+ }
#endif
- static vector_type _S_free_list;
+
+ vector_type&
+ _M_get_free_list()
+ {
+ static vector_type _S_free_list;
+ return _S_free_list;
+ }
/** @brief Performs validation of memory based on their size.
*
@@ -735,12 +746,13 @@ namespace __gnu_cxx
void
_M_validate(size_t* __addr) throw()
{
+ vector_type& __free_list = _M_get_free_list();
const vector_type::size_type __max_size = 64;
- if (_S_free_list.size() >= __max_size)
+ if (__free_list.size() >= __max_size)
{
// Ok, the threshold value has been reached. We determine
// which block to remove from the list of free blocks.
- if (*__addr >= *_S_free_list.back())
+ if (*__addr >= *__free_list.back())
{
// Ok, the new block is greater than or equal to the
// last block in the list of free blocks. We just free
@@ -752,18 +764,18 @@ namespace __gnu_cxx
{
// Deallocate the last block in the list of free lists,
// and insert the new one in it's correct position.
- ::operator delete(static_cast<void*>(_S_free_list.back()));
- _S_free_list.pop_back();
+ ::operator delete(static_cast<void*>(__free_list.back()));
+ __free_list.pop_back();
}
}
// Just add the block to the list of free lists unconditionally.
iterator __temp = __gnu_cxx::balloc::__lower_bound
- (_S_free_list.begin(), _S_free_list.end(),
+ (__free_list.begin(), __free_list.end(),
*__addr, _LT_pointer_compare());
// We may insert the new free list before _temp;
- _S_free_list.insert(__temp, __addr);
+ __free_list.insert(__temp, __addr);
}
/** @brief Decides whether the wastage of memory is acceptable for
@@ -801,7 +813,7 @@ namespace __gnu_cxx
_M_insert(size_t* __addr) throw()
{
#if defined __GTHREADS
- _Auto_Lock __bfl_lock(&_S_bfl_mutex);
+ _Auto_Lock __bfl_lock(_M_get_mutex());
#endif
// Call _M_validate to decide what should be done with
// this particular free list.