Boost logo

Boost-Commit :

From: anthony_at_[hidden]
Date: 2008-05-22 12:33:34


Author: anthonyw
Date: 2008-05-22 12:33:34 EDT (Thu, 22 May 2008)
New Revision: 45661
URL: http://svn.boost.org/trac/boost/changeset/45661

Log:
tidying up move
Text files modified:
   trunk/boost/thread/detail/thread.hpp | 32 +++++++++++++++++++++++++++-----
   trunk/libs/thread/src/pthread/thread.cpp | 30 ------------------------------
   trunk/libs/thread/src/win32/thread.cpp | 31 -------------------------------
   3 files changed, 27 insertions(+), 66 deletions(-)

Modified: trunk/boost/thread/detail/thread.hpp
==============================================================================
--- trunk/boost/thread/detail/thread.hpp (original)
+++ trunk/boost/thread/detail/thread.hpp 2008-05-22 12:33:34 EDT (Thu, 22 May 2008)
@@ -134,10 +134,29 @@
             start_thread();
         }
 
- thread(detail::thread_move_t<thread> x);
- thread& operator=(detail::thread_move_t<thread> x);
- operator detail::thread_move_t<thread>();
- detail::thread_move_t<thread> move();
+ thread(detail::thread_move_t<thread> x)
+ {
+ thread_info=x->thread_info;
+ x->thread_info=0;
+ }
+
+ thread& operator=(detail::thread_move_t<thread> x)
+ {
+ thread new_thread(x);
+ swap(new_thread);
+ return *this;
+ }
+
+ operator detail::thread_move_t<thread>()
+ {
+ return move();
+ }
+
+ detail::thread_move_t<thread> move()
+ {
+ detail::thread_move_t<thread> x(*this);
+ return x;
+ }
 
 #endif
 
@@ -203,7 +222,10 @@
             start_thread();
         }
 
- void swap(thread& x);
+ void swap(thread& x)
+ {
+ thread_info.swap(x.thread_info);
+ }
 
         class id;
         id get_id() const;

Modified: trunk/libs/thread/src/pthread/thread.cpp
==============================================================================
--- trunk/libs/thread/src/pthread/thread.cpp (original)
+++ trunk/libs/thread/src/pthread/thread.cpp 2008-05-22 12:33:34 EDT (Thu, 22 May 2008)
@@ -203,36 +203,6 @@
         detach();
     }
 
- thread::thread(detail::thread_move_t<thread> x)
- {
- lock_guard<mutex> lock(x->thread_info_mutex);
- thread_info=x->thread_info;
- x->thread_info.reset();
- }
-
- thread& thread::operator=(detail::thread_move_t<thread> x)
- {
- thread new_thread(x);
- swap(new_thread);
- return *this;
- }
-
- thread::operator detail::thread_move_t<thread>()
- {
- return move();
- }
-
- detail::thread_move_t<thread> thread::move()
- {
- detail::thread_move_t<thread> x(*this);
- return x;
- }
-
- void thread::swap(thread& x)
- {
- thread_info.swap(x.thread_info);
- }
-
     detail::thread_data_ptr thread::get_thread_info() const
     {
         lock_guard<mutex> l(thread_info_mutex);

Modified: trunk/libs/thread/src/win32/thread.cpp
==============================================================================
--- trunk/libs/thread/src/win32/thread.cpp (original)
+++ trunk/libs/thread/src/win32/thread.cpp 2008-05-22 12:33:34 EDT (Thu, 22 May 2008)
@@ -226,37 +226,6 @@
         detach();
     }
     
-#ifndef BOOST_HAS_RVALUE_REFS
- thread::thread(detail::thread_move_t<thread> x)
- {
- thread_info=x->thread_info;
- x->thread_info=0;
- }
-
- thread& thread::operator=(detail::thread_move_t<thread> x)
- {
- thread new_thread(x);
- swap(new_thread);
- return *this;
- }
-
- thread::operator detail::thread_move_t<thread>()
- {
- return move();
- }
-
- detail::thread_move_t<thread> thread::move()
- {
- detail::thread_move_t<thread> x(*this);
- return x;
- }
-#endif
-
- void thread::swap(thread& x)
- {
- thread_info.swap(x.thread_info);
- }
-
     thread::id thread::get_id() const
     {
         return thread::id(get_thread_info());


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