123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- #ifndef BOOST_CORE_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED
- #define BOOST_CORE_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED
- #if defined(_MSC_VER) && (_MSC_VER >= 1020)
- # pragma once
- #endif
- #include <boost/config.hpp>
- #include <boost/config/pragma_message.hpp>
- #if defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
- #if defined(BOOST_SP_REPORT_IMPLEMENTATION)
- BOOST_PRAGMA_MESSAGE("Using SwitchToThread() in sp_thread_yield")
- #endif
- #include <boost/core/detail/sp_win32_sleep.hpp>
- namespace boost
- {
- namespace core
- {
- namespace detail
- {
- inline void sp_thread_yield() BOOST_NOEXCEPT
- {
- SwitchToThread();
- }
- }
- using boost::core::detail::sp_thread_yield;
- }
- }
- #elif defined(BOOST_HAS_SCHED_YIELD)
- #if defined(BOOST_SP_REPORT_IMPLEMENTATION)
- BOOST_PRAGMA_MESSAGE("Using sched_yield() in sp_thread_yield")
- #endif
- #ifndef _AIX
- # include <sched.h>
- #else
-
- extern "C" int sched_yield(void);
- #endif
- namespace boost
- {
- namespace core
- {
- inline void sp_thread_yield() BOOST_NOEXCEPT
- {
- sched_yield();
- }
- }
- }
- #else
- #if defined(BOOST_SP_REPORT_IMPLEMENTATION)
- BOOST_PRAGMA_MESSAGE("Using sp_thread_pause() in sp_thread_yield")
- #endif
- #include <boost/core/detail/sp_thread_pause.hpp>
- namespace boost
- {
- namespace core
- {
- inline void sp_thread_yield() BOOST_NOEXCEPT
- {
- sp_thread_pause();
- }
- }
- }
- #endif
- #endif
|