--- boost-1_39/boost/thread/locks.hpp +++ boost/thread/locks.hpp @@ -425,6 +425,12 @@ { return ul; } + + template + inline upgrade_lock&& move(upgrade_lock&& ul) + { + return ul; + } #endif template @@ -662,6 +668,39 @@ { try_lock(); } +#ifdef BOOST_HAS_RVALUE_REFS + upgrade_lock(upgrade_lock&& other): + m(other.m),is_locked(other.is_locked) + { + other.is_locked=false; + other.m=0; + } + + upgrade_lock(unique_lock&& other): + m(other.m),is_locked(other.is_locked) + { + if(is_locked) + { + m->unlock_and_lock_upgrade(); + } + other.is_locked=false; + other.m=0; + } + + upgrade_lock& operator=(upgrade_lock&& other) + { + upgrade_lock temp(other); + swap(temp); + return *this; + } + + upgrade_lock& operator=(unique_lock&& other) + { + upgrade_lock temp(other); + swap(temp); + return *this; + } +#else upgrade_lock(detail::thread_move_t > other): m(other->m),is_locked(other->is_locked) { @@ -704,6 +743,7 @@ swap(temp); return *this; } +#endif void swap(upgrade_lock& other) { @@ -772,7 +812,7 @@ other.is_locked=false; if(is_locked) { - m.unlock_upgrade_and_lock(); + m->unlock_upgrade_and_lock(); } } #else @@ -808,6 +848,20 @@ } } +#ifdef BOOST_HAS_RVALUE_REFS + upgrade_to_unique_lock(upgrade_to_unique_lock&& other): + source(other.source),exclusive(move(other.exclusive)) + { + other.source=0; + } + + upgrade_to_unique_lock& operator=(upgrade_to_unique_lock&& other) + { + upgrade_to_unique_lock temp(other); + swap(temp); + return *this; + } +#else upgrade_to_unique_lock(detail::thread_move_t > other): source(other->source),exclusive(move(other->exclusive)) { @@ -820,6 +874,7 @@ swap(temp); return *this; } +#endif void swap(upgrade_to_unique_lock& other) { std::swap(source,other.source);