1 //
2 // detail/null_static_mutex.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2021 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 
11 #ifndef BOOST_ASIO_DETAIL_NULL_STATIC_MUTEX_HPP
12 #define BOOST_ASIO_DETAIL_NULL_STATIC_MUTEX_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include <boost/asio/detail/config.hpp>
19 
20 #if !defined(BOOST_ASIO_HAS_THREADS)
21 
22 #include <boost/asio/detail/scoped_lock.hpp>
23 
24 #include <boost/asio/detail/push_options.hpp>
25 
26 namespace boost {
27 namespace asio {
28 namespace detail {
29 
30 struct null_static_mutex
31 {
32   typedef boost::asio::detail::scoped_lock<null_static_mutex> scoped_lock;
33 
34   // Initialise the mutex.
initboost::asio::detail::null_static_mutex35   void init()
36   {
37   }
38 
39   // Lock the mutex.
lockboost::asio::detail::null_static_mutex40   void lock()
41   {
42   }
43 
44   // Unlock the mutex.
unlockboost::asio::detail::null_static_mutex45   void unlock()
46   {
47   }
48 
49   int unused_;
50 };
51 
52 #define BOOST_ASIO_NULL_STATIC_MUTEX_INIT { 0 }
53 
54 } // namespace detail
55 } // namespace asio
56 } // namespace boost
57 
58 #include <boost/asio/detail/pop_options.hpp>
59 
60 #endif // !defined(BOOST_ASIO_HAS_THREADS)
61 
62 #endif // BOOST_ASIO_DETAIL_NULL_STATIC_MUTEX_HPP
63