$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r72134 - in sandbox/block_ptr/boost: . detail
From: phil_at_[hidden]
Date: 2011-05-24 17:35:02
Author: pbouchard
Date: 2011-05-24 17:35:00 EDT (Tue, 24 May 2011)
New Revision: 72134
URL: http://svn.boost.org/trac/boost/changeset/72134
Log:
* Fixed linkage of static variables to static functions
Text files modified: 
   sandbox/block_ptr/boost/block_ptr.hpp         |    38 +++++++++++++++++++++++---------------  
   sandbox/block_ptr/boost/detail/block_base.hpp |    20 ++++++++++----------                    
   2 files changed, 33 insertions(+), 25 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-24 17:35:00 EDT (Tue, 24 May 2011)
@@ -65,10 +65,6 @@
 {
     typedef detail::atomic_count count_type;
 
-#ifndef BOOST_DISABLE_THREADS
-	static mutex mutex_;
-#endif
-
     count_type count_;								/**< Count of the number of pointers from the stack referencing the same @c block_header .*/
     mutable block_header * redir_;					/**< Redirection in the case of an union multiple sets.*/
 
@@ -78,7 +74,24 @@
     intrusive_list includes_;						/**< List of all sets of an union. */
     intrusive_list elements_;						/**< List of all pointee objects belonging to a @c block_header . */
 
-    static fast_pool_allocator<block_header> pool_;/**< Pool where all sets are allocated. */
+	static mutex & get_mutex()
+	{
+		static mutex mutex_;
+		
+		return mutex_;
+	}
+
+
+	/**
+		Pool where all sets are allocated. 
+	*/
+	
+	static fast_pool_allocator<block_header> & get_pool()
+	{
+    	static fast_pool_allocator<block_header> pool_;
+    	
+    	return pool_;
+    }
 
         /**
                 Initialization of a single @c block_header .
@@ -164,7 +177,7 @@
         
     void * operator new (size_t s)
     {
-        return pool_.allocate(s);
+        return get_pool().allocate(s);
     }
     
         
@@ -190,15 +203,10 @@
         
     void operator delete (void * p)
     {
-        pool_.deallocate(static_cast<block_header *>(p), sizeof(block_header));
+        get_pool().deallocate(static_cast<block_header *>(p), sizeof(block_header));
     }
 };
 
-#ifndef BOOST_DISABLE_THREADS
-mutex block_header::mutex_;
-#endif
-fast_pool_allocator<block_header> block_header::pool_;
-
 
 #define TEMPLATE_DECL(z, n, text) BOOST_PP_COMMA_IF(n) typename T ## n
 #define ARGUMENT_DECL(z, n, text) BOOST_PP_COMMA_IF(n) T ## n const & t ## n
@@ -274,7 +282,7 @@
             block_ptr & operator = (block<V> * p)
             {
 #ifndef BOOST_DISABLE_THREADS
-       			mutex::scoped_lock scoped_lock(block_header::mutex_);
+       			mutex::scoped_lock scoped_lock(block_header::get_mutex());
 #endif
 
                 release(false);
@@ -360,7 +368,7 @@
             block_ptr & operator = (block_ptr<V> const & p)
             {
 #ifndef BOOST_DISABLE_THREADS
-       			mutex::scoped_lock scoped_lock(block_header::mutex_);
+       			mutex::scoped_lock scoped_lock(block_header::get_mutex());
 #endif
 
                 if (ps_->redir() != p.ps_->redir())
@@ -389,7 +397,7 @@
         void reset()
         {
 #ifndef BOOST_DISABLE_THREADS
-       		mutex::scoped_lock scoped_lock(block_header::mutex_);
+       		mutex::scoped_lock scoped_lock(block_header::get_mutex());
 #endif
 
             release(false);
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-24 17:35:00 EDT (Tue, 24 May 2011)
@@ -72,14 +72,14 @@
         typedef std::list< numeric::interval<long>, fast_pool_allocator< numeric::interval<long> > > pool_lii;	/**< Syntax helper. */
 
 #ifndef BOOST_DISABLE_THREADS
-    static thread_specific_ptr<pool_lii> & plii()    /**< Thread specific list of memory boundaries. */
+    static thread_specific_ptr<pool_lii> & get_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> & get_plii()          /**< List of memory boundaries. */
     {
             static std::auto_ptr<pool_lii> plii_;
             
@@ -101,8 +101,8 @@
         
         static void init()
         {
-	    if (plii().get() == 0)
-        	plii().reset(new pool_lii());
+	    if (get_plii().get() == 0)
+        	get_plii().reset(new pool_lii());
         }
         
         /**
@@ -118,13 +118,13 @@
             
         pool_lii::reverse_iterator i;
         
-        for (i = plii()->rbegin(); i != plii()->rend(); i ++)
+        for (i = get_plii()->rbegin(); i != get_plii()->rend(); i ++)
             if (in((long)(p), * i))
                 break;
 
-        plii()->erase(i.base(), plii()->end());
+        get_plii()->erase(i.base(), get_plii()->end());
         
-        return (block_base *)(plii()->rbegin()->lower());
+        return (block_base *)(get_plii()->rbegin()->lower());
     }
     
         
@@ -141,7 +141,7 @@
             
         void * p = pool_t::ordered_malloc(s);
         
-        plii()->push_back(numeric::interval<long>((long) p, long((char *)(p) + s)));
+        get_plii()->push_back(numeric::interval<long>((long) p, long((char *)(p) + s)));
         
         return p;
     }
@@ -160,11 +160,11 @@
             
         pool_lii::reverse_iterator i;
         
-        for (i = plii()->rbegin(); i != plii()->rend(); i ++)
+        for (i = get_plii()->rbegin(); i != get_plii()->rend(); i ++)
             if (in((long)(p), * i))
                 break;
 
-        plii()->erase(i.base(), plii()->end());
+        get_plii()->erase(i.base(), get_plii()->end());
         pool_t::ordered_free(p, s);
     }
 };