Realistic 3D camera system
3D camera system components
posix_static_mutex.hpp
Go to the documentation of this file.
1 //
2 // detail/posix_static_mutex.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2015 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_POSIX_STATIC_MUTEX_HPP
12 #define ASIO_DETAIL_POSIX_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_PTHREADS)
21 
22 #include <pthread.h>
24 
26 
27 namespace asio {
28 namespace detail {
29 
30 struct posix_static_mutex
31 {
33 
34  // Initialise the mutex.
35  void init()
36  {
37  // Nothing to do.
38  }
39 
40  // Lock the mutex.
41  void lock()
42  {
43  (void)::pthread_mutex_lock(&mutex_); // Ignore EINVAL.
44  }
45 
46  // Unlock the mutex.
47  void unlock()
48  {
49  (void)::pthread_mutex_unlock(&mutex_); // Ignore EINVAL.
50  }
51 
52  ::pthread_mutex_t mutex_;
53 };
54 
55 #define ASIO_POSIX_STATIC_MUTEX_INIT { PTHREAD_MUTEX_INITIALIZER }
56 
57 } // namespace detail
58 } // namespace asio
59 
61 
62 #endif // defined(ASIO_HAS_PTHREADS)
63 
64 #endif // ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP
asio::basic_streambuf< Allocator > MatchCondition enable_if< is_match_condition< MatchCondition >::value >::type *detail::async_result_init< ReadHandler, void(asio::error_code, std::size_t)> init(ASIO_MOVE_CAST(ReadHandler)(handler))