2 * Copyright Andrey Semashev 2007 - 2010.
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
8 * \file multiple_lock.hpp
9 * \author Andrey Semashev
12 * \brief This header is the Boost.Log library implementation, see the library documentation
13 * at http://www.boost.org/libs/log/doc/log.html.
16 #if (defined(_MSC_VER) && _MSC_VER > 1000)
18 #endif // _MSC_VER > 1000
20 #ifndef BOOST_LOG_DETAIL_MULTIPLE_LOCK_HPP_INCLUDED_
21 #define BOOST_LOG_DETAIL_MULTIPLE_LOCK_HPP_INCLUDED_
24 #include <boost/utility/addressof.hpp>
25 #include <boost/log/detail/prologue.hpp>
29 namespace BOOST_LOG_NAMESPACE {
33 //! A deadlock-safe lock type that locks two mutexes
34 template< typename T1, typename T2 >
35 class multiple_unique_lock2
41 multiple_unique_lock2(T1& m1, T2& m2) :
42 m_p1(boost::addressof(m1)),
43 m_p2(boost::addressof(m2))
45 std::less< void* > order;
46 if (order(m_p1, m_p2))
57 ~multiple_unique_lock2()
70 #endif // BOOST_LOG_DETAIL_MULTIPLE_LOCK_HPP_INCLUDED_