mirror of
https://github.com/boostorg/core.git
synced 2025-05-09 14:57:46 +00:00
Use SwitchToThread instead of Sleep(0) is sp_thread_yield; the general consensus is that it's newer and 'smarter'
This commit is contained in:
parent
8d6d20059a
commit
66890c3f3d
@ -24,7 +24,7 @@
|
||||
#if defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
|
||||
|
||||
#if defined(BOOST_SP_REPORT_IMPLEMENTATION)
|
||||
BOOST_PRAGMA_MESSAGE("Using Sleep(0) in sp_thread_yield")
|
||||
BOOST_PRAGMA_MESSAGE("Using SwitchToThread() in sp_thread_yield")
|
||||
#endif
|
||||
|
||||
#include <boost/core/detail/sp_win32_sleep.hpp>
|
||||
@ -38,7 +38,7 @@ namespace detail
|
||||
|
||||
inline void sp_thread_yield() BOOST_NOEXCEPT
|
||||
{
|
||||
Sleep( 0 );
|
||||
SwitchToThread();
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
@ -41,6 +41,8 @@ namespace detail
|
||||
extern "C" __declspec(dllimport) void BOOST_CORE_SP_STDCALL Sleep( unsigned long ms );
|
||||
#endif
|
||||
|
||||
extern "C" __declspec(dllimport) int BOOST_CORE_SP_STDCALL SwitchToThread();
|
||||
|
||||
#undef BOOST_CORE_SP_STDCALL
|
||||
|
||||
#endif // !defined( BOOST_USE_WINDOWS_H )
|
||||
|
Loading…
x
Reference in New Issue
Block a user