Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71932 - in sandbox/block_ptr/boost: . detail
From: phil_at_[hidden]
Date: 2011-05-13 21:13:39


Author: pbouchard
Date: 2011-05-13 21:13:38 EDT (Fri, 13 May 2011)
New Revision: 71932
URL: http://svn.boost.org/trac/boost/changeset/71932

Log:
* Renamed mutex and locking redir()
Text files modified:
   sandbox/block_ptr/boost/block_ptr.hpp | 7 ++++++-
   sandbox/block_ptr/boost/detail/block_base.hpp | 10 +++++-----
   2 files changed, 11 insertions(+), 6 deletions(-)

Modified: sandbox/block_ptr/boost/block_ptr.hpp
==============================================================================
--- sandbox/block_ptr/boost/block_ptr.hpp (original)
+++ sandbox/block_ptr/boost/block_ptr.hpp 2011-05-13 21:13:38 EDT (Fri, 13 May 2011)
@@ -65,7 +65,7 @@
     typedef detail::atomic_count count_type;
 
 #ifndef BOOST_DISABLE_THREADS
- mutex mutex_;
+ mutable mutex mutex_;
 #endif
 
     count_type count_; /**< Count of the number of pointers from the stack referencing the same @c block_header .*/
@@ -135,6 +135,10 @@
         
     block_header * redir() const
     {
+#ifndef BOOST_DISABLE_THREADS
+ mutex::scoped_lock scoped_lock(mutex_);
+#endif
+
             block_header * p = redir_;
             
         while (p != p->redir_)
@@ -159,6 +163,7 @@
 #ifndef BOOST_DISABLE_THREADS
                 mutex::scoped_lock scoped_lock(mutex_);
 #endif
+
             redir_ = q;
             redir_->includes_.merge(includes_);
             redir_->elements_.merge(elements_);

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 21:13:38 EDT (Fri, 13 May 2011)
@@ -68,7 +68,7 @@
 struct pool
 {
 #ifndef BOOST_DISABLE_THREADS
- static mutex pool_mutex_;
+ static mutex mutex_;
 #endif
 
         typedef boost::singleton_pool<pool, sizeof(char)> pool_t;
@@ -119,7 +119,7 @@
     static block_base * top(void * p)
     {
 #ifndef BOOST_DISABLE_THREADS
- mutex::scoped_lock scoped_lock(pool_mutex_);
+ mutex::scoped_lock scoped_lock(mutex_);
 #endif
 
             init();
@@ -146,7 +146,7 @@
     static void * allocate(std::size_t s)
     {
 #ifndef BOOST_DISABLE_THREADS
- mutex::scoped_lock scoped_lock(pool_mutex_);
+ mutex::scoped_lock scoped_lock(mutex_);
 #endif
 
             init();
@@ -169,7 +169,7 @@
     static void deallocate(void * p, std::size_t s)
     {
 #ifndef BOOST_DISABLE_THREADS
- mutex::scoped_lock scoped_lock(pool_mutex_);
+ mutex::scoped_lock scoped_lock(mutex_);
 #endif
 
             init();
@@ -186,7 +186,7 @@
 };
 
 #ifndef BOOST_DISABLE_THREADS
-mutex pool::pool_mutex_;
+mutex 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