/Src/Dependencies/Boost/boost/memory_order.hpp

http://hadesmem.googlecode.com/ · C++ Header · 53 lines · 18 code · 9 blank · 26 comment · 1 complexity · f9c8ae35cca5b2e0498de58d4b065a8e MD5 · raw file

  1. #ifndef BOOST_MEMORY_ORDER_HPP_INCLUDED
  2. #define BOOST_MEMORY_ORDER_HPP_INCLUDED
  3. // MS compatible compilers support #pragma once
  4. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  5. # pragma once
  6. #endif
  7. // boost/memory_order.hpp
  8. //
  9. // Defines enum boost::memory_order per the C++0x working draft
  10. //
  11. // Copyright (c) 2008, 2009 Peter Dimov
  12. //
  13. // Distributed under the Boost Software License, Version 1.0.
  14. // See accompanying file LICENSE_1_0.txt or copy at
  15. // http://www.boost.org/LICENSE_1_0.txt)
  16. namespace boost
  17. {
  18. //
  19. // Enum values are chosen so that code that needs to insert
  20. // a trailing fence for acquire semantics can use a single
  21. // test such as:
  22. //
  23. // if( mo & memory_order_acquire ) { ...fence... }
  24. //
  25. // For leading fences one can use:
  26. //
  27. // if( mo & memory_order_release ) { ...fence... }
  28. //
  29. // Architectures such as Alpha that need a fence on consume
  30. // can use:
  31. //
  32. // if( mo & ( memory_order_acquire | memory_order_consume ) ) { ...fence... }
  33. //
  34. enum memory_order
  35. {
  36. memory_order_relaxed = 0,
  37. memory_order_acquire = 1,
  38. memory_order_release = 2,
  39. memory_order_acq_rel = 3, // acquire | release
  40. memory_order_seq_cst = 7, // acq_rel | 4
  41. memory_order_consume = 8
  42. };
  43. } // namespace boost
  44. #endif // #ifndef BOOST_MEMORY_ORDER_HPP_INCLUDED