1 #ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED
2 #define BOOST_SMART_PTR_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED
4 // MS compatible compilers support #pragma once
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
10 // boost/smart_ptr/detail/sp_thread_yield.hpp
12 // inline void bost::detail::sp_thread_yield();
14 // Gives up the remainder of the time slice,
15 // as if by calling sched_yield().
17 // Copyright 2008, 2020 Peter Dimov
18 // Distributed under the Boost Software License, Version 1.0
19 // https://www.boost.org/LICENSE_1_0.txt
21 #include <boost/config.hpp>
22 #include <boost/config/pragma_message.hpp>
24 #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
26 #if defined(BOOST_SP_REPORT_IMPLEMENTATION)
27 BOOST_PRAGMA_MESSAGE("Using Sleep(0) in sp_thread_yield")
30 #include <boost/smart_ptr/detail/sp_win32_sleep.hpp>
38 inline void sp_thread_yield()
47 #elif defined(BOOST_HAS_SCHED_YIELD)
49 #if defined(BOOST_SP_REPORT_IMPLEMENTATION)
50 BOOST_PRAGMA_MESSAGE("Using sched_yield() in sp_thread_yield")
56 // AIX's sched.h defines ::var which sometimes conflicts with Lambda's var
57 extern "C" int sched_yield(void);
66 inline void sp_thread_yield()
77 #if defined(BOOST_SP_REPORT_IMPLEMENTATION)
78 BOOST_PRAGMA_MESSAGE("Using sp_thread_pause() in sp_thread_yield")
81 #include <boost/smart_ptr/detail/sp_thread_pause.hpp>
89 inline void sp_thread_yield()
100 #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED