File indexing completed on 2025-01-30 09:33:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef BOOST_ATOMIC_DETAIL_WAIT_OPS_DRAGONFLY_UMTX_HPP_INCLUDED_
0016 #define BOOST_ATOMIC_DETAIL_WAIT_OPS_DRAGONFLY_UMTX_HPP_INCLUDED_
0017
0018 #include <unistd.h>
0019 #include <boost/memory_order.hpp>
0020 #include <boost/atomic/detail/config.hpp>
0021 #include <boost/atomic/detail/wait_operations_fwd.hpp>
0022 #include <boost/atomic/detail/header.hpp>
0023
0024 #ifdef BOOST_HAS_PRAGMA_ONCE
0025 #pragma once
0026 #endif
0027
0028 namespace boost {
0029 namespace atomics {
0030 namespace detail {
0031
0032 template< typename Base, bool Interprocess >
0033 struct wait_operations< Base, sizeof(int), true, Interprocess > :
0034 public Base
0035 {
0036 typedef Base base_type;
0037 typedef typename base_type::storage_type storage_type;
0038
0039 static BOOST_CONSTEXPR_OR_CONST bool always_has_native_wait_notify = true;
0040
0041 static BOOST_FORCEINLINE bool has_native_wait_notify(storage_type const volatile&) BOOST_NOEXCEPT
0042 {
0043 return true;
0044 }
0045
0046 static BOOST_FORCEINLINE storage_type wait(storage_type const volatile& storage, storage_type old_val, memory_order order) BOOST_NOEXCEPT
0047 {
0048 storage_type new_val = base_type::load(storage, order);
0049 while (new_val == old_val)
0050 {
0051 ::umtx_sleep(reinterpret_cast< int* >(const_cast< storage_type* >(&storage)), static_cast< int >(old_val), 0);
0052 new_val = base_type::load(storage, order);
0053 }
0054
0055 return new_val;
0056 }
0057
0058 static BOOST_FORCEINLINE void notify_one(storage_type volatile& storage) BOOST_NOEXCEPT
0059 {
0060 ::umtx_wakeup(reinterpret_cast< int* >(const_cast< storage_type* >(&storage)), 1);
0061 }
0062
0063 static BOOST_FORCEINLINE void notify_all(storage_type volatile& storage) BOOST_NOEXCEPT
0064 {
0065 ::umtx_wakeup(reinterpret_cast< int* >(const_cast< storage_type* >(&storage)), 0);
0066 }
0067 };
0068
0069 }
0070 }
0071 }
0072
0073 #include <boost/atomic/detail/footer.hpp>
0074
0075 #endif