File indexing completed on 2025-01-18 09:28:42
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP
0012 #define BOOST_ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP
0013
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif
0017
0018 #include <boost/asio/detail/config.hpp>
0019
0020 #if defined(BOOST_ASIO_HAS_PTHREADS)
0021
0022 #include <pthread.h>
0023 #include <boost/asio/detail/scoped_lock.hpp>
0024
0025 #include <boost/asio/detail/push_options.hpp>
0026
0027 namespace boost {
0028 namespace asio {
0029 namespace detail {
0030
0031 struct posix_static_mutex
0032 {
0033 typedef boost::asio::detail::scoped_lock<posix_static_mutex> scoped_lock;
0034
0035
0036 void init()
0037 {
0038
0039 }
0040
0041
0042 void lock()
0043 {
0044 (void)::pthread_mutex_lock(&mutex_);
0045 }
0046
0047
0048 void unlock()
0049 {
0050 (void)::pthread_mutex_unlock(&mutex_);
0051 }
0052
0053 ::pthread_mutex_t mutex_;
0054 };
0055
0056 #define BOOST_ASIO_POSIX_STATIC_MUTEX_INIT { PTHREAD_MUTEX_INITIALIZER }
0057
0058 }
0059 }
0060 }
0061
0062 #include <boost/asio/detail/pop_options.hpp>
0063
0064 #endif
0065
0066 #endif