fake_mutex.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright Andrey Semashev 2007 - 2015.
  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. #ifndef BOOST_LOG_DETAIL_FAKE_MUTEX_HPP_INCLUDED_
  16. #define BOOST_LOG_DETAIL_FAKE_MUTEX_HPP_INCLUDED_
  17. #include <boost/log/detail/config.hpp>
  18. #include <boost/log/detail/header.hpp>
  19. #ifdef BOOST_HAS_PRAGMA_ONCE
  20. #pragma once
  21. #endif
  22. namespace boost {
  23. BOOST_LOG_OPEN_NAMESPACE
  24. namespace aux {
  25. //! 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.
  26. class fake_mutex
  27. {
  28. public:
  29. BOOST_DEFAULTED_FUNCTION(fake_mutex(), {})
  30. void lock() {}
  31. bool try_lock() { return true; }
  32. template< typename T >
  33. bool timed_lock(T const&) { return true; }
  34. void unlock() {}
  35. // Copying prohibited
  36. BOOST_DELETED_FUNCTION(fake_mutex(fake_mutex const&))
  37. BOOST_DELETED_FUNCTION(fake_mutex& operator=(fake_mutex const&))
  38. };
  39. } // namespace aux
  40. BOOST_LOG_CLOSE_NAMESPACE // namespace log
  41. } // namespace boost
  42. #include <boost/log/detail/footer.hpp>
  43. #endif // BOOST_LOG_DETAIL_FAKE_MUTEX_HPP_INCLUDED_