Interleave calls to sp_thread_pause and sp_thread_sleep in yield_k, instead of doing a single pause at 0

This commit is contained in:
Peter Dimov
2023-06-03 02:16:52 +03:00
parent aacfb25c82
commit b34786c4d4

View File

@ -32,13 +32,13 @@ inline void yield( unsigned k )
// Experiments on Windows and Fedora 32 show that a single pause,
// followed by an immediate sp_thread_sleep(), is best.
if( k == 0 )
if( k & 1 )
{
boost::core::sp_thread_pause();
boost::core::sp_thread_sleep();
}
else
{
boost::core::sp_thread_sleep();
boost::core::sp_thread_pause();
}
}