Mercurial > hg > vamp-build-and-test
annotate DEPENDENCIES/generic/include/boost/asio/detail/posix_static_mutex.hpp @ 125:34e428693f5d vext
Vext -> Repoint
author | Chris Cannam |
---|---|
date | Thu, 14 Jun 2018 11:15:39 +0100 |
parents | c530137014c0 |
children |
rev | line source |
---|---|
Chris@16 | 1 // |
Chris@16 | 2 // detail/posix_static_mutex.hpp |
Chris@16 | 3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
Chris@16 | 4 // |
Chris@101 | 5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) |
Chris@16 | 6 // |
Chris@16 | 7 // Distributed under the Boost Software License, Version 1.0. (See accompanying |
Chris@16 | 8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
Chris@16 | 9 // |
Chris@16 | 10 |
Chris@16 | 11 #ifndef BOOST_ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP |
Chris@16 | 12 #define BOOST_ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP |
Chris@16 | 13 |
Chris@16 | 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) |
Chris@16 | 15 # pragma once |
Chris@16 | 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) |
Chris@16 | 17 |
Chris@16 | 18 #include <boost/asio/detail/config.hpp> |
Chris@16 | 19 |
Chris@16 | 20 #if defined(BOOST_ASIO_HAS_PTHREADS) |
Chris@16 | 21 |
Chris@16 | 22 #include <pthread.h> |
Chris@16 | 23 #include <boost/asio/detail/scoped_lock.hpp> |
Chris@16 | 24 |
Chris@16 | 25 #include <boost/asio/detail/push_options.hpp> |
Chris@16 | 26 |
Chris@16 | 27 namespace boost { |
Chris@16 | 28 namespace asio { |
Chris@16 | 29 namespace detail { |
Chris@16 | 30 |
Chris@16 | 31 struct posix_static_mutex |
Chris@16 | 32 { |
Chris@16 | 33 typedef boost::asio::detail::scoped_lock<posix_static_mutex> scoped_lock; |
Chris@16 | 34 |
Chris@16 | 35 // Initialise the mutex. |
Chris@16 | 36 void init() |
Chris@16 | 37 { |
Chris@16 | 38 // Nothing to do. |
Chris@16 | 39 } |
Chris@16 | 40 |
Chris@16 | 41 // Lock the mutex. |
Chris@16 | 42 void lock() |
Chris@16 | 43 { |
Chris@16 | 44 (void)::pthread_mutex_lock(&mutex_); // Ignore EINVAL. |
Chris@16 | 45 } |
Chris@16 | 46 |
Chris@16 | 47 // Unlock the mutex. |
Chris@16 | 48 void unlock() |
Chris@16 | 49 { |
Chris@16 | 50 (void)::pthread_mutex_unlock(&mutex_); // Ignore EINVAL. |
Chris@16 | 51 } |
Chris@16 | 52 |
Chris@16 | 53 ::pthread_mutex_t mutex_; |
Chris@16 | 54 }; |
Chris@16 | 55 |
Chris@16 | 56 #define BOOST_ASIO_POSIX_STATIC_MUTEX_INIT { PTHREAD_MUTEX_INITIALIZER } |
Chris@16 | 57 |
Chris@16 | 58 } // namespace detail |
Chris@16 | 59 } // namespace asio |
Chris@16 | 60 } // namespace boost |
Chris@16 | 61 |
Chris@16 | 62 #include <boost/asio/detail/pop_options.hpp> |
Chris@16 | 63 |
Chris@16 | 64 #endif // defined(BOOST_ASIO_HAS_PTHREADS) |
Chris@16 | 65 |
Chris@16 | 66 #endif // BOOST_ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP |