1 // 2 // detail/static_mutex.hpp 3 // ~~~~~~~~~~~~~~~~~~~~~~~ 4 // 5 // Copyright (c) 2003-2016 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 ASIO_DETAIL_STATIC_MUTEX_HPP 12 #define ASIO_DETAIL_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 "asio/detail/config.hpp" 19 20 #if !defined(ASIO_HAS_THREADS) 21 # include "asio/detail/null_static_mutex.hpp" 22 #elif defined(ASIO_WINDOWS) 23 # include "asio/detail/win_static_mutex.hpp" 24 #elif defined(ASIO_HAS_PTHREADS) 25 # include "asio/detail/posix_static_mutex.hpp" 26 #elif defined(ASIO_HAS_STD_MUTEX_AND_CONDVAR) 27 # include "asio/detail/std_static_mutex.hpp" 28 #else 29 # error Only Windows and POSIX are supported! 30 #endif 31 32 namespace asio { 33 namespace detail { 34 35 #if !defined(ASIO_HAS_THREADS) 36 typedef null_static_mutex static_mutex; 37 # define ASIO_STATIC_MUTEX_INIT ASIO_NULL_STATIC_MUTEX_INIT 38 #elif defined(ASIO_WINDOWS) 39 typedef win_static_mutex static_mutex; 40 # define ASIO_STATIC_MUTEX_INIT ASIO_WIN_STATIC_MUTEX_INIT 41 #elif defined(ASIO_HAS_PTHREADS) 42 typedef posix_static_mutex static_mutex; 43 # define ASIO_STATIC_MUTEX_INIT ASIO_POSIX_STATIC_MUTEX_INIT 44 #elif defined(ASIO_HAS_STD_MUTEX_AND_CONDVAR) 45 typedef std_static_mutex static_mutex; 46 # define ASIO_STATIC_MUTEX_INIT ASIO_STD_STATIC_MUTEX_INIT 47 #endif 48 49 } // namespace detail 50 } // namespace asio 51 52 #endif // ASIO_DETAIL_STATIC_MUTEX_HPP 53