|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r71930 - sandbox/block_ptr/boost/detail
From: phil_at_[hidden]
Date: 2011-05-13 20:46:26
Author: pbouchard
Date: 2011-05-13 20:46:25 EDT (Fri, 13 May 2011)
New Revision: 71930
URL: http://svn.boost.org/trac/boost/changeset/71930
Log:
* Fixed crash with fast_pool_allocator destruction
Text files modified:
sandbox/block_ptr/boost/detail/block_base.hpp | 40 ++++++++++++++++++++--------------------
1 files changed, 20 insertions(+), 20 deletions(-)
Modified: sandbox/block_ptr/boost/detail/block_base.hpp
==============================================================================
--- sandbox/block_ptr/boost/detail/block_base.hpp (original)
+++ sandbox/block_ptr/boost/detail/block_base.hpp 2011-05-13 20:46:25 EDT (Fri, 13 May 2011)
@@ -75,12 +75,20 @@
typedef std::list< numeric::interval<long>, fast_pool_allocator< numeric::interval<long> > > pool_lii; /**< Syntax helper. */
- //static pool_lii plii_; /**< List of memory boundaries. */
-
#ifndef BOOST_DISABLE_THREADS
- static thread_specific_ptr<pool_lii> plii_; /**< Thread specific list of memory boundaries. */
+ static thread_specific_ptr<pool_lii> & plii() /**< Thread specific list of memory boundaries. */
+ {
+ static thread_specific_ptr<pool_lii> plii_;
+
+ return plii_;
+ }
#else
- static std::auto_ptr<pool_lii> plii_; /**< List of memory boundaries. */
+ static std::auto_ptr<pool_lii> & plii_() /**< List of memory boundaries. */
+ {
+ static std::auto_ptr<pool_lii> plii_;
+
+ return plii_;
+ }
#endif
/**
@@ -97,8 +105,8 @@
static void init()
{
- if (plii_.get() == 0)
- plii_.reset(new pool_lii());
+ if (plii().get() == 0)
+ plii().reset(new pool_lii());
}
/**
@@ -118,13 +126,13 @@
pool_lii::reverse_iterator i;
- for (i = plii_->rbegin(); i != plii_->rend(); i ++)
+ for (i = plii()->rbegin(); i != plii()->rend(); i ++)
if (in((long)(p), * i))
break;
- plii_->erase(i.base(), plii_->end());
+ plii()->erase(i.base(), plii()->end());
- return (block_base *)(plii_->rbegin()->lower());
+ return (block_base *)(plii()->rbegin()->lower());
}
@@ -145,7 +153,7 @@
void * p = pool_t::ordered_malloc(s);
- plii_->push_back(numeric::interval<long>((long) p, long((char *)(p) + s)));
+ plii()->push_back(numeric::interval<long>((long) p, long((char *)(p) + s)));
return p;
}
@@ -168,23 +176,15 @@
pool_lii::reverse_iterator i;
- for (i = plii_->rbegin(); i != plii_->rend(); i ++)
+ for (i = plii()->rbegin(); i != plii()->rend(); i ++)
if (in((long)(p), * i))
break;
- plii_->erase(i.base(), plii_->end());
+ plii()->erase(i.base(), plii()->end());
pool_t::ordered_free(p, s);
}
};
-//pool::pool_lii pool::plii_;
-
-#ifndef BOOST_DISABLE_THREADS
-thread_specific_ptr<pool::pool_lii> pool::plii_;
-#else
-std::auto_ptr<pool::pool_lii> pool::plii_;
-#endif
-
#ifndef BOOST_DISABLE_THREADS
mutex pool::pool_mutex_;
#endif
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk