Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59752 - trunk/boost/thread
From: anthony_at_[hidden]
Date: 2010-02-18 16:54:47


Author: anthonyw
Date: 2010-02-18 16:54:46 EST (Thu, 18 Feb 2010)
New Revision: 59752
URL: http://svn.boost.org/trac/boost/changeset/59752

Log:
Fixes to some uses of rvalue references; patch to avoid var size warnings on 64-bit platforms in future.hpp
Text files modified:
   trunk/boost/thread/future.hpp | 5 +++--
   trunk/boost/thread/locks.hpp | 31 ++++++++++++++++++-------------
   2 files changed, 21 insertions(+), 15 deletions(-)

Modified: trunk/boost/thread/future.hpp
==============================================================================
--- trunk/boost/thread/future.hpp (original)
+++ trunk/boost/thread/future.hpp 2010-02-18 16:54:46 EST (Thu, 18 Feb 2010)
@@ -404,13 +404,14 @@
             
             struct all_futures_lock
             {
- unsigned count;
+ typedef std::vector<registered_waiter>::size_type count_type;
+ count_type count;
                 boost::scoped_array<boost::unique_lock<boost::mutex> > locks;
                 
                 all_futures_lock(std::vector<registered_waiter>& futures):
                     count(futures.size()),locks(new boost::unique_lock<boost::mutex>[count])
                 {
- for(unsigned i=0;i<count;++i)
+ for(count_type i=0;i<count;++i)
                     {
                         locks[i]=boost::unique_lock<boost::mutex>(futures[i].future->mutex);
                     }

Modified: trunk/boost/thread/locks.hpp
==============================================================================
--- trunk/boost/thread/locks.hpp (original)
+++ trunk/boost/thread/locks.hpp 2010-02-18 16:54:46 EST (Thu, 18 Feb 2010)
@@ -321,17 +321,17 @@
             swap(temp);
             return *this;
         }
- void swap(unique_lock& other)
- {
- std::swap(m,other.m);
- std::swap(is_locked,other.is_locked);
- }
         void swap(detail::thread_move_t<unique_lock<Mutex> > other)
         {
             std::swap(m,other->m);
             std::swap(is_locked,other->is_locked);
         }
 #endif
+ void swap(unique_lock& other)
+ {
+ std::swap(m,other.m);
+ std::swap(is_locked,other.is_locked);
+ }
         
         ~unique_lock()
         {
@@ -422,19 +422,24 @@
     {
         lhs.swap(rhs);
     }
-#else
+#endif
     template<typename Mutex>
     void swap(unique_lock<Mutex>& lhs,unique_lock<Mutex>& rhs)
     {
         lhs.swap(rhs);
     }
-#endif
 
 #ifndef BOOST_NO_RVALUE_REFERENCES
     template<typename Mutex>
     inline unique_lock<Mutex>&& move(unique_lock<Mutex>&& ul)
     {
- return ul;
+ return static_cast<unique_lock<Mutex>&&>(ul);
+ }
+
+ template<typename Mutex>
+ inline unique_lock<Mutex>&& move(unique_lock<Mutex>& ul)
+ {
+ return static_cast<unique_lock<Mutex>&&>(ul);
     }
 #endif
 
@@ -542,17 +547,17 @@
             std::swap(is_locked,other.is_locked);
         }
 #else
- void swap(shared_lock& other)
- {
- std::swap(m,other.m);
- std::swap(is_locked,other.is_locked);
- }
         void swap(boost::detail::thread_move_t<shared_lock<Mutex> > other)
         {
             std::swap(m,other->m);
             std::swap(is_locked,other->is_locked);
         }
 #endif
+ void swap(shared_lock& other)
+ {
+ std::swap(m,other.m);
+ std::swap(is_locked,other.is_locked);
+ }
 
         Mutex* mutex() const
         {


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