00001 #ifndef BOOST_MEMORY_ORDER_HPP_INCLUDED 00002 #define BOOST_MEMORY_ORDER_HPP_INCLUDED 00003 00004 // MS compatible compilers support #pragma once 00005 00006 #if defined(_MSC_VER) && (_MSC_VER >= 1020) 00007 # pragma once 00008 #endif 00009 00010 // boost/memory_order.hpp 00011 // 00012 // Defines enum boost::memory_order per the C++0x working draft 00013 // 00014 // Copyright (c) 2008, 2009 Peter Dimov 00015 // 00016 // Distributed under the Boost Software License, Version 1.0. 00017 // See accompanying file LICENSE_1_0.txt or copy at 00018 // http://www.boost.org/LICENSE_1_0.txt) 00019 00020 00021 namespace boost 00022 { 00023 00024 // 00025 // Enum values are chosen so that code that needs to insert 00026 // a trailing fence for acquire semantics can use a single 00027 // test such as: 00028 // 00029 // if( mo & memory_order_acquire ) { ...fence... } 00030 // 00031 // For leading fences one can use: 00032 // 00033 // if( mo & memory_order_release ) { ...fence... } 00034 // 00035 // Architectures such as Alpha that need a fence on consume 00036 // can use: 00037 // 00038 // if( mo & ( memory_order_acquire | memory_order_consume ) ) { ...fence... } 00039 // 00040 00041 enum memory_order 00042 { 00043 memory_order_relaxed = 0, 00044 memory_order_acquire = 1, 00045 memory_order_release = 2, 00046 memory_order_acq_rel = 3, // acquire | release 00047 memory_order_seq_cst = 7, // acq_rel | 4 00048 memory_order_consume = 8 00049 }; 00050 00051 } // namespace boost 00052 00053 #endif // #ifndef BOOST_MEMORY_ORDER_HPP_INCLUDED