Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56354 - in trunk: boost/multi_index/detail libs/multi_index/doc
From: joaquin_at_[hidden]
Date: 2009-09-22 09:29:09


Author: joaquin
Date: 2009-09-22 09:29:08 EDT (Tue, 22 Sep 2009)
New Revision: 56354
URL: http://svn.boost.org/trac/boost/changeset/56354

Log:
fixed #3462
Text files modified:
   trunk/boost/multi_index/detail/safe_mode.hpp | 24 +++++++++++++++---------
   trunk/libs/multi_index/doc/release_notes.html | 6 +++++-
   2 files changed, 20 insertions(+), 10 deletions(-)

Modified: trunk/boost/multi_index/detail/safe_mode.hpp
==============================================================================
--- trunk/boost/multi_index/detail/safe_mode.hpp (original)
+++ trunk/boost/multi_index/detail/safe_mode.hpp 2009-09-22 09:29:08 EDT (Tue, 22 Sep 2009)
@@ -1,4 +1,4 @@
-/* Copyright 2003-2008 Joaquin M Lopez Munoz.
+/* Copyright 2003-2009 Joaquin M Lopez Munoz.
  * Distributed under the Boost Software License, Version 1.0.
  * (See accompanying file LICENSE_1_0.txt or copy at
  * http://www.boost.org/LICENSE_1_0.txt)
@@ -237,15 +237,21 @@
 inline void detach_equivalent_iterators(Iterator& it)
 {
   if(it.valid()){
- Iterator *prev_,*next_;
- for(
- prev_=static_cast<Iterator*>(&it.cont->header);
- (next_=static_cast<Iterator*>(prev_->next))!=0;){
- if(next_!=&it&&*next_==it){
- prev_->next=next_->next;
- next_->cont=0;
+ {
+#if defined(BOOST_HAS_THREADS)
+ boost::detail::lightweight_mutex::scoped_lock lock(it.cont->mutex);
+#endif
+
+ Iterator *prev_,*next_;
+ for(
+ prev_=static_cast<Iterator*>(&it.cont->header);
+ (next_=static_cast<Iterator*>(prev_->next))!=0;){
+ if(next_!=&it&&*next_==it){
+ prev_->next=next_->next;
+ next_->cont=0;
+ }
+ else prev_=next_;
       }
- else prev_=next_;
     }
     it.detach();
   }

Modified: trunk/libs/multi_index/doc/release_notes.html
==============================================================================
--- trunk/libs/multi_index/doc/release_notes.html (original)
+++ trunk/libs/multi_index/doc/release_notes.html 2009-09-22 09:29:08 EDT (Tue, 22 Sep 2009)
@@ -52,6 +52,10 @@
   <a href="../../serialization/doc/tutorial.html#versioning">class version</a> has been
   bumped from 0 to 1.
   </li>
+ <li>Fixed a concurrency bug in the implementation of
+ safe mode
+ (ticket #3462).
+ </li>
 </ul>
 </p>
 
@@ -278,7 +282,7 @@
 
 <br>
 
-<p>Revised September 3rd 2009</p>
+<p>Revised September 22nd 2009</p>
 
 <p>&copy; Copyright 2003-2009 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
 Distributed under the Boost Software


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