Realistic 3D camera system
3D camera system components
macos_fenced_block.hpp
Go to the documentation of this file.
1 //
2 // detail/macos_fenced_block.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_MACOS_FENCED_BLOCK_HPP
12 #define ASIO_DETAIL_MACOS_FENCED_BLOCK_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(__MACH__) && defined(__APPLE__)
21 
22 #include <libkern/OSAtomic.h>
23 
25 
26 namespace asio {
27 namespace detail {
28 
29 class macos_fenced_block
30  : private noncopyable
31 {
32 public:
33  enum half_t { half };
34  enum full_t { full };
35 
36  // Constructor for a half fenced block.
37  explicit macos_fenced_block(half_t)
38  {
39  }
40 
41  // Constructor for a full fenced block.
42  explicit macos_fenced_block(full_t)
43  {
44  OSMemoryBarrier();
45  }
46 
47  // Destructor.
48  ~macos_fenced_block()
49  {
50  OSMemoryBarrier();
51  }
52 };
53 
54 } // namespace detail
55 } // namespace asio
56 
58 
59 #endif // defined(__MACH__) && defined(__APPLE__)
60 
61 #endif // ASIO_DETAIL_MACOS_FENCED_BLOCK_HPP