forked from boostorg/smart_ptr
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:
@ -32,13 +32,13 @@ inline void yield( unsigned k )
|
|||||||
// Experiments on Windows and Fedora 32 show that a single pause,
|
// Experiments on Windows and Fedora 32 show that a single pause,
|
||||||
// followed by an immediate sp_thread_sleep(), is best.
|
// 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
|
else
|
||||||
{
|
{
|
||||||
boost::core::sp_thread_sleep();
|
boost::core::sp_thread_pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user