Use BOOST_SMT_PAUSE starting from the first iteration

This commit is contained in:
Peter Dimov
2020-06-06 16:54:57 +03:00
parent d38f64ded9
commit f8dcf5f6f4

View File

@ -74,15 +74,12 @@ namespace detail
inline void yield( unsigned k ) BOOST_NOEXCEPT
{
if( k < 4 )
if( k < 16 )
{
}
#if defined( BOOST_SMT_PAUSE )
else if( k < 16 )
{
BOOST_SMT_PAUSE
}
#endif
}
else if( k < 32 )
{
Sleep( 0 );
@ -102,8 +99,8 @@ inline void yield( unsigned k ) BOOST_NOEXCEPT
#ifndef _AIX
#include <sched.h>
#else
// AIX's sched.h defines ::var which sometimes conflicts with Lambda's var
extern "C" int sched_yield(void);
// AIX's sched.h defines ::var which sometimes conflicts with Lambda's var
extern "C" int sched_yield(void);
#endif
#include <time.h>
@ -116,15 +113,12 @@ namespace detail
inline void yield( unsigned k )
{
if( k < 4 )
if( k < 16 )
{
}
#if defined( BOOST_SMT_PAUSE )
else if( k < 16 )
{
BOOST_SMT_PAUSE
}
#endif
}
else if( k < 32 || k & 1 )
{
sched_yield();