1 /* 2 * Distributed under the Boost Software License, Version 1.0. 3 * (See accompanying file LICENSE_1_0.txt or copy at 4 * http://www.boost.org/LICENSE_1_0.txt) 5 * 6 * Copyright (c) 2020 Andrey Semashev 7 */ 8 /*! 9 * \file atomic/detail/once_flag.hpp 10 * 11 * This header declares \c once_flag structure for controlling one time initialization 12 */ 13 14 #ifndef BOOST_ATOMIC_DETAIL_ONCE_FLAG_HPP_INCLUDED_ 15 #define BOOST_ATOMIC_DETAIL_ONCE_FLAG_HPP_INCLUDED_ 16 17 #include <boost/atomic/detail/config.hpp> 18 #include <boost/atomic/detail/aligned_variable.hpp> 19 #include <boost/atomic/detail/core_operations.hpp> 20 #include <boost/atomic/detail/header.hpp> 21 22 #ifdef BOOST_HAS_PRAGMA_ONCE 23 #pragma once 24 #endif 25 26 namespace boost { 27 namespace atomics { 28 namespace detail { 29 30 typedef atomics::detail::core_operations< 1u, false, false > once_flag_operations; 31 32 struct once_flag 33 { 34 BOOST_ATOMIC_DETAIL_ALIGNED_VAR(once_flag_operations::storage_alignment, once_flag_operations::storage_type, m_flag); 35 }; 36 37 } // namespace detail 38 } // namespace atomics 39 } // namespace boost 40 41 #include <boost/atomic/detail/footer.hpp> 42 43 #endif // BOOST_ATOMIC_DETAIL_ONCE_FLAG_HPP_INCLUDED_ 44