null_mutex.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //
  2. // null_mutex.hpp
  3. // ~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef ASIO_DETAIL_NULL_MUTEX_HPP
  11. #define ASIO_DETAIL_NULL_MUTEX_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include "asio/detail/push_options.hpp"
  16. #include "asio/detail/push_options.hpp"
  17. #include <boost/config.hpp>
  18. #include "asio/detail/pop_options.hpp"
  19. #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS)
  20. #include "asio/detail/noncopyable.hpp"
  21. #include "asio/detail/scoped_lock.hpp"
  22. namespace asio {
  23. namespace detail {
  24. class null_mutex
  25. : private noncopyable
  26. {
  27. public:
  28. typedef asio::detail::scoped_lock<null_mutex> scoped_lock;
  29. // Constructor.
  30. null_mutex()
  31. {
  32. }
  33. // Destructor.
  34. ~null_mutex()
  35. {
  36. }
  37. // Lock the mutex.
  38. void lock()
  39. {
  40. }
  41. // Unlock the mutex.
  42. void unlock()
  43. {
  44. }
  45. };
  46. } // namespace detail
  47. } // namespace asio
  48. #endif // !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS)
  49. #include "asio/detail/pop_options.hpp"
  50. #endif // ASIO_DETAIL_NULL_MUTEX_HPP