Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57243 - in branches/release: boost boost/thread boost/thread/detail boost/thread/pthread libs/thread libs/thread/doc libs/thread/test
From: anthony_at_[hidden]
Date: 2009-10-30 05:50:15


Author: anthonyw
Date: 2009-10-30 05:50:13 EDT (Fri, 30 Oct 2009)
New Revision: 57243
URL: http://svn.boost.org/trac/boost/changeset/57243

Log:
Merged boost.thread changes from trunk
Added:
   branches/release/boost/thread/detail/thread_group.hpp
      - copied unchanged from r57242, /trunk/boost/thread/detail/thread_group.hpp
   branches/release/boost/thread/detail/thread_interruption.hpp
      - copied unchanged from r57242, /trunk/boost/thread/detail/thread_interruption.hpp
   branches/release/boost/thread/future.hpp
      - copied unchanged from r57242, /trunk/boost/thread/future.hpp
   branches/release/libs/thread/doc/future_ref.qbk
      - copied unchanged from r57242, /trunk/libs/thread/doc/future_ref.qbk
   branches/release/libs/thread/doc/futures.qbk
      - copied unchanged from r57242, /trunk/libs/thread/doc/futures.qbk
   branches/release/libs/thread/test/test_futures.cpp
      - copied unchanged from r57242, /trunk/libs/thread/test/test_futures.cpp
Properties modified:
   branches/release/boost/thread/ (props changed)
   branches/release/boost/thread.hpp (contents, props changed)
   branches/release/libs/thread/ (props changed)
Text files modified:
   branches/release/boost/thread.hpp | 3
   branches/release/boost/thread/detail/thread.hpp | 98 ----------------------------------------
   branches/release/boost/thread/locks.hpp | 37 ++++++++++----
   branches/release/boost/thread/pthread/shared_mutex.hpp | 2
   branches/release/boost/thread/thread.hpp | 2
   branches/release/libs/thread/doc/changes.qbk | 6 ++
   branches/release/libs/thread/doc/thread.qbk | 1
   branches/release/libs/thread/test/Jamfile.v2 | 1
   8 files changed, 38 insertions(+), 112 deletions(-)

Modified: branches/release/boost/thread.hpp
==============================================================================
--- branches/release/boost/thread.hpp (original)
+++ branches/release/boost/thread.hpp 2009-10-30 05:50:13 EDT (Fri, 30 Oct 2009)
@@ -1,6 +1,6 @@
 // Copyright (C) 2001-2003
 // William E. Kempf
-// (C) Copyright 2008 Anthony Williams
+// (C) Copyright 2008-9 Anthony Williams
 //
 // 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)
@@ -21,5 +21,6 @@
 #include <boost/thread/locks.hpp>
 #include <boost/thread/shared_mutex.hpp>
 #include <boost/thread/barrier.hpp>
+#include <boost/thread/future.hpp>
 
 #endif

Modified: branches/release/boost/thread/detail/thread.hpp
==============================================================================
--- branches/release/boost/thread/detail/thread.hpp (original)
+++ branches/release/boost/thread/detail/thread.hpp 2009-10-30 05:50:13 EDT (Fri, 30 Oct 2009)
@@ -357,27 +357,6 @@
 
     namespace this_thread
     {
- class BOOST_THREAD_DECL disable_interruption
- {
- disable_interruption(const disable_interruption&);
- disable_interruption& operator=(const disable_interruption&);
-
- bool interruption_was_enabled;
- friend class restore_interruption;
- public:
- disable_interruption();
- ~disable_interruption();
- };
-
- class BOOST_THREAD_DECL restore_interruption
- {
- restore_interruption(const restore_interruption&);
- restore_interruption& operator=(const restore_interruption&);
- public:
- explicit restore_interruption(disable_interruption& d);
- ~restore_interruption();
- };
-
         thread::id BOOST_THREAD_DECL get_id();
 
         void BOOST_THREAD_DECL interruption_point();
@@ -497,83 +476,6 @@
             detail::add_thread_exit_function(thread_exit_func);
         }
     }
-
- class thread_group:
- private noncopyable
- {
- public:
- ~thread_group()
- {
- for(std::list<thread*>::iterator it=threads.begin(),end=threads.end();
- it!=end;
- ++it)
- {
- delete *it;
- }
- }
-
- template<typename F>
- thread* create_thread(F threadfunc)
- {
- boost::lock_guard<mutex> guard(m);
- std::auto_ptr<thread> new_thread(new thread(threadfunc));
- threads.push_back(new_thread.get());
- return new_thread.release();
- }
-
- void add_thread(thread* thrd)
- {
- if(thrd)
- {
- boost::lock_guard<mutex> guard(m);
- threads.push_back(thrd);
- }
- }
-
- void remove_thread(thread* thrd)
- {
- boost::lock_guard<mutex> guard(m);
- std::list<thread*>::iterator const it=std::find(threads.begin(),threads.end(),thrd);
- if(it!=threads.end())
- {
- threads.erase(it);
- }
- }
-
- void join_all()
- {
- boost::lock_guard<mutex> guard(m);
-
- for(std::list<thread*>::iterator it=threads.begin(),end=threads.end();
- it!=end;
- ++it)
- {
- (*it)->join();
- }
- }
-
- void interrupt_all()
- {
- boost::lock_guard<mutex> guard(m);
-
- for(std::list<thread*>::iterator it=threads.begin(),end=threads.end();
- it!=end;
- ++it)
- {
- (*it)->interrupt();
- }
- }
-
- size_t size() const
- {
- boost::lock_guard<mutex> guard(m);
- return threads.size();
- }
-
- private:
- std::list<thread*> threads;
- mutable mutex m;
- };
 }
 
 #ifdef BOOST_MSVC

Modified: branches/release/boost/thread/locks.hpp
==============================================================================
--- branches/release/boost/thread/locks.hpp (original)
+++ branches/release/boost/thread/locks.hpp 2009-10-30 05:50:13 EDT (Fri, 30 Oct 2009)
@@ -263,16 +263,16 @@
         }
 
 
- unique_lock& operator=(unique_lock<Mutex>&& other)
+ unique_lock& operator=(unique_lock&& other)
         {
- unique_lock temp(other);
+ unique_lock temp(other.move());
             swap(temp);
             return *this;
         }
 
         unique_lock& operator=(upgrade_lock<Mutex>&& other)
         {
- unique_lock temp(other);
+ unique_lock temp(other.move());
             swap(temp);
             return *this;
         }
@@ -783,7 +783,7 @@
         other.is_locked=false;
         if(is_locked)
         {
- m.unlock_upgrade_and_lock();
+ m->unlock_upgrade_and_lock();
         }
     }
 #else
@@ -875,6 +875,28 @@
             try_lock_wrapper(Mutex& m_,try_to_lock_t):
                 base(m_,try_to_lock)
             {}
+#ifdef BOOST_HAS_RVALUE_REFS
+ try_lock_wrapper(try_lock_wrapper&& other):
+ base(other.move())
+ {}
+
+ try_lock_wrapper&& move()
+ {
+ return static_cast<try_lock_wrapper&&>(*this);
+ }
+
+ try_lock_wrapper& operator=(try_lock_wrapper<Mutex>&& other)
+ {
+ try_lock_wrapper temp(other.move());
+ swap(temp);
+ return *this;
+ }
+
+ void swap(try_lock_wrapper&& other)
+ {
+ base::swap(other);
+ }
+#else
             try_lock_wrapper(detail::thread_move_t<try_lock_wrapper<Mutex> > other):
                 base(detail::thread_move_t<base>(*other))
             {}
@@ -896,12 +918,6 @@
                 return *this;
             }
 
-#ifdef BOOST_HAS_RVALUE_REFS
- void swap(try_lock_wrapper&& other)
- {
- base::swap(other);
- }
-#else
             void swap(try_lock_wrapper& other)
             {
                 base::swap(other);
@@ -911,7 +927,6 @@
                 base::swap(*other);
             }
 #endif
-
             void lock()
             {
                 base::lock();

Modified: branches/release/boost/thread/pthread/shared_mutex.hpp
==============================================================================
--- branches/release/boost/thread/pthread/shared_mutex.hpp (original)
+++ branches/release/boost/thread/pthread/shared_mutex.hpp 2009-10-30 05:50:13 EDT (Fri, 30 Oct 2009)
@@ -10,8 +10,8 @@
 #include <boost/assert.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/thread/mutex.hpp>
-#include <boost/thread/thread.hpp>
 #include <boost/thread/condition_variable.hpp>
+#include <boost/thread/detail/thread_interruption.hpp>
 
 #include <boost/config/abi_prefix.hpp>
 

Modified: branches/release/boost/thread/thread.hpp
==============================================================================
--- branches/release/boost/thread/thread.hpp (original)
+++ branches/release/boost/thread/thread.hpp 2009-10-30 05:50:13 EDT (Fri, 30 Oct 2009)
@@ -20,6 +20,8 @@
 #endif
 
 #include <boost/thread/detail/thread.hpp>
+#include <boost/thread/detail/thread_interruption.hpp>
+#include <boost/thread/detail/thread_group.hpp>
 
 
 #endif

Modified: branches/release/libs/thread/doc/changes.qbk
==============================================================================
--- branches/release/libs/thread/doc/changes.qbk (original)
+++ branches/release/libs/thread/doc/changes.qbk 2009-10-30 05:50:13 EDT (Fri, 30 Oct 2009)
@@ -5,7 +5,11 @@
   http://www.boost.org/LICENSE_1_0.txt).
 ]
 
-[section:changes Changes since boost 1.35]
+[section:changes Changes since boost 1.40]
+
+The 1.41.0 release of Boost adds futures to the thread library. There are also a few minor changes.
+
+[heading Changes since boost 1.35]
 
 The 1.36.0 release of Boost includes a few new features in the thread library:
 

Modified: branches/release/libs/thread/doc/thread.qbk
==============================================================================
--- branches/release/libs/thread/doc/thread.qbk (original)
+++ branches/release/libs/thread/doc/thread.qbk 2009-10-30 05:50:13 EDT (Fri, 30 Oct 2009)
@@ -158,6 +158,7 @@
 [include condition_variables.qbk]
 [include once.qbk]
 [include barrier.qbk]
+[include futures.qbk]
 [endsect]
 
 [include tss.qbk]

Modified: branches/release/libs/thread/test/Jamfile.v2
==============================================================================
--- branches/release/libs/thread/test/Jamfile.v2 (original)
+++ branches/release/libs/thread/test/Jamfile.v2 2009-10-30 05:50:13 EDT (Fri, 30 Oct 2009)
@@ -57,6 +57,7 @@
           [ thread-run test_shared_mutex_timed_locks.cpp ]
           [ thread-run test_lock_concept.cpp ]
           [ thread-run test_generic_locks.cpp ]
+ [ thread-run test_futures.cpp ]
           [ compile-fail no_implicit_move_from_lvalue_thread.cpp ]
           [ compile-fail no_implicit_assign_from_lvalue_thread.cpp ]
     ;


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