multiple_unique_lock2(T1& m1, T2& m2) :
     m_p1(boost::addressof(m1)),
     m_p2(boost::addressof(m2))
 {
     std::less< void* > order;
     if (order(m_p1, m_p2))
     {
         m_p1->lock();
         m_p2->lock();
     }
     else
     {
         m_p2->lock();
         m_p1->lock();
     }
 }
Esempio n. 2
0
		bool lock(T1& t1, T2& t2) {
			if(t1.lock())return true;

			if(t2.lock()) {
				t1.unlock();
				return true;
			}
			return false;
		}