$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r71488 - in sandbox/mm_ptr: boost boost/detail libs/smart_ptr/example
From: phil_at_[hidden]
Date: 2011-04-25 15:08:08
Author: pbouchard
Date: 2011-04-25 15:08:07 EDT (Mon, 25 Apr 2011)
New Revision: 71488
URL: http://svn.boost.org/trac/boost/changeset/71488
Log:
* Added multithread support
Text files modified: 
   sandbox/mm_ptr/boost/detail/mm_base.hpp        |     5 +----                                   
   sandbox/mm_ptr/boost/mm_ptr.hpp                |    11 +++++++++++                             
   sandbox/mm_ptr/libs/smart_ptr/example/Makefile |     2 +-                                      
   3 files changed, 13 insertions(+), 5 deletions(-)
Modified: sandbox/mm_ptr/boost/detail/mm_base.hpp
==============================================================================
--- sandbox/mm_ptr/boost/detail/mm_base.hpp	(original)
+++ sandbox/mm_ptr/boost/detail/mm_base.hpp	2011-04-25 15:08:07 EDT (Mon, 25 Apr 2011)
@@ -26,9 +26,6 @@
 #include <stack>
 #include <limits>
 
-// Bypassing linkage by default
-#define BOOST_SH_DISABLE_THREADS
-
 #include <boost/thread.hpp>
 #include <boost/thread/tss.hpp>
 #include <boost/pool/pool.hpp>
@@ -72,7 +69,7 @@
 {
         typedef std::list< numeric::interval<long>, fast_pool_allocator< numeric::interval<long> > > pool_lii;	/**< Syntax helper. */
 
-#ifndef BOOST_SH_DISABLE_THREADS
+#ifndef BOOST_DISABLE_THREADS
     thread_specific_ptr<pool_lii> plii_;			/**< Thread specific list of memory boundaries. */
 #else
     std::auto_ptr<pool_lii> plii_;					/**< List of memory boundaries. */
Modified: sandbox/mm_ptr/boost/mm_ptr.hpp
==============================================================================
--- sandbox/mm_ptr/boost/mm_ptr.hpp	(original)
+++ sandbox/mm_ptr/boost/mm_ptr.hpp	2011-04-25 15:08:07 EDT (Mon, 25 Apr 2011)
@@ -33,6 +33,7 @@
 #include <boost/pool/pool_alloc.hpp>
 #include <boost/type_traits/add_pointer.hpp>
 #include <boost/smart_ptr/detail/atomic_count.hpp>
+#include <boost/thread/thread.hpp>
 
 #include <boost/detail/intrusive_list.hpp>
 #include <boost/detail/intrusive_stack.hpp>
@@ -69,6 +70,10 @@
     intrusive_list includes_;						/**< List of all sets of an union. */
     intrusive_list elements_;						/**< List of all pointee objects belonging to a @c mm_header . */
 
+#ifndef BOOST_DISABLE_THREADS
+	mutex mutex_;
+#endif
+
     static fast_pool_allocator<mm_header> pool_;	/**< Pool where all sets are allocated. */
 
 public:
@@ -98,6 +103,9 @@
 
         if (-- p->count_ == 0)
         {
+#ifndef BOOST_DISABLE_THREADS
+        	mutex::scoped_lock scoped_lock(mutex_);
+#endif
                         p->destroy_ = true;
             for (intrusive_list::iterator<mm_base, & mm_base::mm_tag_> i; i = p->elements_.begin(), i != p->elements_.end(); )
                 delete &* i;
@@ -143,6 +151,9 @@
     {
         if (redir_ != p->redir())
         {
+#ifndef BOOST_DISABLE_THREADS
+        	mutex::scoped_lock scoped_lock(mutex_);
+#endif
             redir_ = p->redir();
             redir_->includes_.merge(includes_);
             redir_->elements_.merge(elements_);
Modified: sandbox/mm_ptr/libs/smart_ptr/example/Makefile
==============================================================================
--- sandbox/mm_ptr/libs/smart_ptr/example/Makefile	(original)
+++ sandbox/mm_ptr/libs/smart_ptr/example/Makefile	2011-04-25 15:08:07 EDT (Mon, 25 Apr 2011)
@@ -2,7 +2,7 @@
 CXXFLAGS        := -ggdb3
 INCPATH         := -I../../.. -I../../../../../include
 LINK            := g++
-LFLAGS          := -L../../../../../lib
+LFLAGS          := -L../../../../../lib -lboost_thread
 RM              := rm
 HEADERS         := $(wildcard *.h)
 SOURCES         := $(wildcard *.cpp)