1 /* 2 * Copyright Andrey Semashev 2016. 3 * Distributed under the Boost Software License, Version 1.0. 4 * (See accompanying file LICENSE_1_0.txt or copy at 5 * http://www.boost.org/LICENSE_1_0.txt) 6 */ 7 /*! 8 * \file pause.hpp 9 * \author Andrey Semashev 10 * \date 06.01.2016 11 * 12 * \brief This header is the Boost.Log library implementation, see the library documentation 13 * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html. 14 */ 15 16 #ifndef BOOST_LOG_DETAIL_PAUSE_HPP_INCLUDED_ 17 #define BOOST_LOG_DETAIL_PAUSE_HPP_INCLUDED_ 18 19 #include <boost/log/detail/config.hpp> 20 #include <boost/log/detail/header.hpp> 21 22 #ifdef BOOST_HAS_PRAGMA_ONCE 23 #pragma once 24 #endif 25 26 #if defined(__INTEL_COMPILER) || defined(_MSC_VER) 27 # if defined(_M_IX86) 28 # define BOOST_LOG_AUX_PAUSE __asm { pause } 29 # elif defined(_M_AMD64) 30 extern "C" void _mm_pause(void); 31 # if defined(BOOST_MSVC) 32 # pragma intrinsic(_mm_pause) 33 # endif 34 # define BOOST_LOG_AUX_PAUSE _mm_pause() 35 # endif 36 #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) 37 # define BOOST_LOG_AUX_PAUSE __asm__ __volatile__("pause;") 38 #endif 39 40 namespace boost { 41 42 BOOST_LOG_OPEN_NAMESPACE 43 44 namespace aux { 45 pause()46BOOST_FORCEINLINE void pause() BOOST_NOEXCEPT 47 { 48 #if defined(BOOST_LOG_AUX_PAUSE) 49 BOOST_LOG_AUX_PAUSE; 50 #endif 51 } 52 53 } // namespace aux 54 55 BOOST_LOG_CLOSE_NAMESPACE // namespace log 56 57 } // namespace boost 58 59 #include <boost/log/detail/footer.hpp> 60 61 #endif // BOOST_LOG_DETAIL_PAUSE_HPP_INCLUDED_ 62