annotate DEPENDENCIES/generic/include/boost/atomic/detail/atomic_flag.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents f46d142149f5
children
rev   line source
Chris@102 1 /*
Chris@102 2 * Distributed under the Boost Software License, Version 1.0.
Chris@102 3 * (See accompanying file LICENSE_1_0.txt or copy at
Chris@102 4 * http://www.boost.org/LICENSE_1_0.txt)
Chris@102 5 *
Chris@102 6 * Copyright (c) 2014 Andrey Semashev
Chris@102 7 */
Chris@102 8 /*!
Chris@102 9 * \file atomic/detail/atomic_flag.hpp
Chris@102 10 *
Chris@102 11 * This header contains interface definition of \c atomic_flag.
Chris@102 12 */
Chris@102 13
Chris@102 14 #ifndef BOOST_ATOMIC_DETAIL_ATOMIC_FLAG_HPP_INCLUDED_
Chris@102 15 #define BOOST_ATOMIC_DETAIL_ATOMIC_FLAG_HPP_INCLUDED_
Chris@102 16
Chris@102 17 #include <boost/assert.hpp>
Chris@102 18 #include <boost/memory_order.hpp>
Chris@102 19 #include <boost/atomic/detail/config.hpp>
Chris@102 20 #include <boost/atomic/detail/operations_lockfree.hpp>
Chris@102 21
Chris@102 22 #ifdef BOOST_HAS_PRAGMA_ONCE
Chris@102 23 #pragma once
Chris@102 24 #endif
Chris@102 25
Chris@102 26 /*
Chris@102 27 * IMPLEMENTATION NOTE: All interface functions MUST be declared with BOOST_FORCEINLINE,
Chris@102 28 * see comment for convert_memory_order_to_gcc in ops_gcc_atomic.hpp.
Chris@102 29 */
Chris@102 30
Chris@102 31 namespace boost {
Chris@102 32 namespace atomics {
Chris@102 33
Chris@102 34 #if defined(BOOST_NO_CXX11_CONSTEXPR) || defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
Chris@102 35 #define BOOST_ATOMIC_NO_ATOMIC_FLAG_INIT
Chris@102 36 #else
Chris@102 37 #define BOOST_ATOMIC_FLAG_INIT {}
Chris@102 38 #endif
Chris@102 39
Chris@102 40 struct atomic_flag
Chris@102 41 {
Chris@102 42 typedef atomics::detail::operations< 1u, false > operations;
Chris@102 43 typedef operations::storage_type storage_type;
Chris@102 44
Chris@102 45 storage_type m_storage;
Chris@102 46
Chris@102 47 BOOST_FORCEINLINE BOOST_CONSTEXPR atomic_flag() BOOST_NOEXCEPT : m_storage(0)
Chris@102 48 {
Chris@102 49 }
Chris@102 50
Chris@102 51 BOOST_FORCEINLINE bool test_and_set(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
Chris@102 52 {
Chris@102 53 return operations::test_and_set(m_storage, order);
Chris@102 54 }
Chris@102 55
Chris@102 56 BOOST_FORCEINLINE void clear(memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
Chris@102 57 {
Chris@102 58 BOOST_ASSERT(order != memory_order_acquire);
Chris@102 59 BOOST_ASSERT(order != memory_order_acq_rel);
Chris@102 60 operations::clear(m_storage, order);
Chris@102 61 }
Chris@102 62
Chris@102 63 BOOST_DELETED_FUNCTION(atomic_flag(atomic_flag const&))
Chris@102 64 BOOST_DELETED_FUNCTION(atomic_flag& operator= (atomic_flag const&))
Chris@102 65 };
Chris@102 66
Chris@102 67 } // namespace atomics
Chris@102 68 } // namespace boost
Chris@102 69
Chris@102 70 #endif // BOOST_ATOMIC_DETAIL_ATOMIC_FLAG_HPP_INCLUDED_