Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / log / detail / fake_mutex.hpp
1 /*
2  *          Copyright Andrey Semashev 2007 - 2014.
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)
6  */
7 /*!
8  * \file   fake_mutex.hpp
9  * \author Andrey Semashev
10  * \date   31.07.2011
11  *
12  * \brief  This header is the Boost.Log library implementation, see the library documentation
13  *         at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
14  */
15
16 #ifndef BOOST_LOG_DETAIL_FAKE_MUTEX_HPP_INCLUDED_
17 #define BOOST_LOG_DETAIL_FAKE_MUTEX_HPP_INCLUDED_
18
19 #include <boost/log/detail/config.hpp>
20 #include <boost/log/detail/header.hpp>
21
22 #ifdef BOOST_HAS_PRAGMA_ONCE
23 #pragma once
24 #endif
25
26 namespace boost {
27
28 BOOST_LOG_OPEN_NAMESPACE
29
30 namespace aux {
31
32 //! Fake mutex that doesn't do anything. Note: we're not using \c null_mutex from Boost.Thread in order not to introduce false dependencies on Boost.Thread and Boost.Chrono.
33 class fake_mutex
34 {
35 public:
36     BOOST_DEFAULTED_FUNCTION(fake_mutex(), {})
37     void lock() {}
38     bool try_lock() { return true; }
39     template< typename T >
40     bool timed_lock(T const&) { return true; }
41     void unlock() {}
42
43     // Copying prohibited
44     BOOST_DELETED_FUNCTION(fake_mutex(fake_mutex const&))
45     BOOST_DELETED_FUNCTION(fake_mutex& operator=(fake_mutex const&))
46 };
47
48 } // namespace aux
49
50 BOOST_LOG_CLOSE_NAMESPACE // namespace log
51
52 } // namespace boost
53
54 #include <boost/log/detail/footer.hpp>
55
56 #endif // BOOST_LOG_DETAIL_FAKE_MUTEX_HPP_INCLUDED_