File indexing completed on 2025-01-30 09:33:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_ATOMIC_DETAIL_PAUSE_HPP_INCLUDED_
0011 #define BOOST_ATOMIC_DETAIL_PAUSE_HPP_INCLUDED_
0012
0013 #include <boost/atomic/detail/config.hpp>
0014 #include <boost/atomic/detail/header.hpp>
0015
0016 #ifdef BOOST_HAS_PRAGMA_ONCE
0017 #pragma once
0018 #endif
0019
0020 #if defined(_MSC_VER)
0021 #if defined(_M_AMD64) || defined(_M_IX86)
0022 extern "C" void _mm_pause(void);
0023 #if defined(BOOST_MSVC)
0024 #pragma intrinsic(_mm_pause)
0025 #endif
0026 #elif defined(_M_ARM64) || defined(_M_ARM)
0027 extern "C" void __yield(void);
0028 #if defined(BOOST_MSVC)
0029 #pragma intrinsic(__yield)
0030 #endif
0031 #endif
0032 #endif
0033
0034 namespace boost {
0035 namespace atomics {
0036 namespace detail {
0037
0038 BOOST_FORCEINLINE void pause() BOOST_NOEXCEPT
0039 {
0040 #if defined(_MSC_VER)
0041 #if defined(_M_AMD64) || defined(_M_IX86)
0042 _mm_pause();
0043 #elif defined(_M_ARM64) || defined(_M_ARM)
0044 __yield();
0045 #endif
0046 #elif defined(__GNUC__)
0047 #if defined(__i386__) || defined(__x86_64__)
0048 __asm__ __volatile__("pause;" : : : "memory");
0049 #elif (defined(__ARM_ARCH) && __ARM_ARCH >= 8) || defined(__ARM_ARCH_8A__) || defined(__aarch64__)
0050 __asm__ __volatile__("yield;" : : : "memory");
0051 #endif
0052 #endif
0053 }
0054
0055 }
0056 }
0057 }
0058
0059 #include <boost/atomic/detail/footer.hpp>
0060
0061 #endif