gcc_hppa_fenced_block.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // detail/gcc_hppa_fenced_block.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2013 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. #ifndef BOOST_ASIO_DETAIL_GCC_HPPA_FENCED_BLOCK_HPP
  11. #define BOOST_ASIO_DETAIL_GCC_HPPA_FENCED_BLOCK_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/config.hpp>
  16. #if defined(__GNUC__) && (defined(__hppa) || defined(__hppa__))
  17. #include <boost/asio/detail/push_options.hpp>
  18. namespace boost {
  19. namespace asio {
  20. namespace detail {
  21. class gcc_hppa_fenced_block
  22. : private noncopyable
  23. {
  24. public:
  25. enum half_t { half };
  26. enum full_t { full };
  27. // Constructor for a half fenced block.
  28. explicit gcc_hppa_fenced_block(half_t)
  29. {
  30. }
  31. // Constructor for a full fenced block.
  32. explicit gcc_hppa_fenced_block(full_t)
  33. {
  34. barrier();
  35. }
  36. // Destructor.
  37. ~gcc_hppa_fenced_block()
  38. {
  39. barrier();
  40. }
  41. private:
  42. static void barrier()
  43. {
  44. // This is just a placeholder and almost certainly not sufficient.
  45. __asm__ __volatile__ ("" : : : "memory");
  46. }
  47. };
  48. } // namespace detail
  49. } // namespace asio
  50. } // namespace boost
  51. #include <boost/asio/detail/pop_options.hpp>
  52. #endif // defined(__GNUC__) && (defined(__hppa) || defined(__hppa__))
  53. #endif // BOOST_ASIO_DETAIL_GCC_HPPA_FENCED_BLOCK_HPP