Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / asio / detail / gcc_hppa_fenced_block.hpp
1 //
2 // detail/gcc_hppa_fenced_block.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2014 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 BOOST_ASIO_DETAIL_GCC_HPPA_FENCED_BLOCK_HPP
12 #define BOOST_ASIO_DETAIL_GCC_HPPA_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 <boost/asio/detail/config.hpp>
19
20 #if defined(__GNUC__) && (defined(__hppa) || defined(__hppa__))
21
22 #include <boost/asio/detail/push_options.hpp>
23
24 namespace boost {
25 namespace asio {
26 namespace detail {
27
28 class gcc_hppa_fenced_block
29   : private noncopyable
30 {
31 public:
32   enum half_t { half };
33   enum full_t { full };
34
35   // Constructor for a half fenced block.
36   explicit gcc_hppa_fenced_block(half_t)
37   {
38   }
39
40   // Constructor for a full fenced block.
41   explicit gcc_hppa_fenced_block(full_t)
42   {
43     barrier();
44   }
45
46   // Destructor.
47   ~gcc_hppa_fenced_block()
48   {
49     barrier();
50   }
51
52 private:
53   static void barrier()
54   {
55     // This is just a placeholder and almost certainly not sufficient.
56     __asm__ __volatile__ ("" : : : "memory");
57   }
58 };
59
60 } // namespace detail
61 } // namespace asio
62 } // namespace boost
63
64 #include <boost/asio/detail/pop_options.hpp>
65
66 #endif // defined(__GNUC__) && (defined(__hppa) || defined(__hppa__))
67
68 #endif // BOOST_ASIO_DETAIL_GCC_HPPA_FENCED_BLOCK_HPP