Chris@102: /* Chris@102: * Distributed under the Boost Software License, Version 1.0. Chris@102: * (See accompanying file LICENSE_1_0.txt or copy at Chris@102: * http://www.boost.org/LICENSE_1_0.txt) Chris@102: * Chris@102: * (C) Copyright 2013 Tim Blechmann Chris@102: * (C) Copyright 2013 Andrey Semashev Chris@102: */ Chris@102: Chris@102: #ifndef BOOST_ATOMIC_DETAIL_PAUSE_HPP_INCLUDED_ Chris@102: #define BOOST_ATOMIC_DETAIL_PAUSE_HPP_INCLUDED_ Chris@102: Chris@102: #include Chris@102: Chris@102: #ifdef BOOST_HAS_PRAGMA_ONCE Chris@102: #pragma once Chris@102: #endif Chris@102: Chris@102: #if defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_IX86)) Chris@102: extern "C" void _mm_pause(void); Chris@102: #if defined(BOOST_MSVC) Chris@102: #pragma intrinsic(_mm_pause) Chris@102: #endif Chris@102: #endif Chris@102: Chris@102: namespace boost { Chris@102: namespace atomics { Chris@102: namespace detail { Chris@102: Chris@102: BOOST_FORCEINLINE void pause() BOOST_NOEXCEPT Chris@102: { Chris@102: #if defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_IX86)) Chris@102: _mm_pause(); Chris@102: #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) Chris@102: __asm__ __volatile__("pause;"); Chris@102: #endif Chris@102: } Chris@102: Chris@102: } // namespace detail Chris@102: } // namespace atomics Chris@102: } // namespace boost Chris@102: Chris@102: #endif // BOOST_ATOMIC_DETAIL_PAUSE_HPP_INCLUDED_