Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-17 08:38:47

0001 /*
0002  * Distributed under the Boost Software License, Version 1.0.
0003  * (See accompanying file LICENSE_1_0.txt or copy at
0004  * http://www.boost.org/LICENSE_1_0.txt)
0005  *
0006  * Copyright (c) 2025 Andrey Semashev
0007  */
0008 /*!
0009  * \file   atomic/wait_result.hpp
0010  *
0011  * This header contains definition of the \c wait_result class template.
0012  */
0013 
0014 #ifndef BOOST_ATOMIC_WAIT_RESULT_HPP_INCLUDED_
0015 #define BOOST_ATOMIC_WAIT_RESULT_HPP_INCLUDED_
0016 
0017 #include <type_traits>
0018 #include <boost/atomic/detail/config.hpp>
0019 #include <boost/atomic/detail/header.hpp>
0020 
0021 #ifdef BOOST_HAS_PRAGMA_ONCE
0022 #pragma once
0023 #endif
0024 
0025 namespace boost {
0026 namespace atomics {
0027 
0028 //! The structure contains the result of a timed waiting operation
0029 template< typename T >
0030 struct wait_result
0031 {
0032     //! Last value read as part of the waiting operation
0033     T value;
0034     //! Indicates whether the waiting operation has ended due to timeout
0035     bool timeout;
0036 
0037     constexpr wait_result() noexcept(std::is_nothrow_default_constructible< T >::value) :
0038         value(),
0039         timeout(false)
0040     {
0041     }
0042 
0043     template< typename U, typename = typename std::enable_if< std::is_constructible< T, U&& >::value >::type >
0044     constexpr wait_result(U&& val, bool tout) noexcept(std::is_nothrow_constructible< T, U&& >::value) :
0045         value(static_cast< U&& >(val)),
0046         timeout(tout)
0047     {
0048     }
0049 };
0050 
0051 } // namespace atomics
0052 } // namespace boost
0053 
0054 #include <boost/atomic/detail/footer.hpp>
0055 
0056 #endif // BOOST_ATOMIC_WAIT_RESULT_HPP_INCLUDED_