Change yield_k to not use sp_thread_yield; using sp_thread_sleep is always strictly superior, at least on Windows

This commit is contained in:
Peter Dimov
2020-06-07 21:24:21 +03:00
parent 8afe162910
commit 72ca834ae8

View File

@ -175,14 +175,17 @@ namespace detail
inline void yield( unsigned k ) BOOST_NOEXCEPT
{
if( k < 16 )
// Experiments show that a simple sp_thread_sleep() here is best;
// leave a few pause instructions out of mostly superstition.
// (These are verified to not degrade performance.)
//
// There seems to be no benefit from calling sp_thread_yield()
// at any time.
if( k < 8 )
{
BOOST_SMT_PAUSE
}
else if( k < 32 )
{
sp_thread_yield();
}
else
{
sp_thread_sleep();