forked from boostorg/smart_ptr
Use BOOST_SMT_PAUSE starting from the first iteration
This commit is contained in:
@@ -74,15 +74,12 @@ namespace detail
|
|||||||
|
|
||||||
inline void yield( unsigned k ) BOOST_NOEXCEPT
|
inline void yield( unsigned k ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
if( k < 4 )
|
if( k < 16 )
|
||||||
{
|
{
|
||||||
}
|
|
||||||
#if defined( BOOST_SMT_PAUSE )
|
#if defined( BOOST_SMT_PAUSE )
|
||||||
else if( k < 16 )
|
|
||||||
{
|
|
||||||
BOOST_SMT_PAUSE
|
BOOST_SMT_PAUSE
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
else if( k < 32 )
|
else if( k < 32 )
|
||||||
{
|
{
|
||||||
Sleep( 0 );
|
Sleep( 0 );
|
||||||
@@ -102,8 +99,8 @@ inline void yield( unsigned k ) BOOST_NOEXCEPT
|
|||||||
#ifndef _AIX
|
#ifndef _AIX
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#else
|
#else
|
||||||
// AIX's sched.h defines ::var which sometimes conflicts with Lambda's var
|
// AIX's sched.h defines ::var which sometimes conflicts with Lambda's var
|
||||||
extern "C" int sched_yield(void);
|
extern "C" int sched_yield(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -116,15 +113,12 @@ namespace detail
|
|||||||
|
|
||||||
inline void yield( unsigned k )
|
inline void yield( unsigned k )
|
||||||
{
|
{
|
||||||
if( k < 4 )
|
if( k < 16 )
|
||||||
{
|
{
|
||||||
}
|
|
||||||
#if defined( BOOST_SMT_PAUSE )
|
#if defined( BOOST_SMT_PAUSE )
|
||||||
else if( k < 16 )
|
|
||||||
{
|
|
||||||
BOOST_SMT_PAUSE
|
BOOST_SMT_PAUSE
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
else if( k < 32 || k & 1 )
|
else if( k < 32 || k & 1 )
|
||||||
{
|
{
|
||||||
sched_yield();
|
sched_yield();
|
||||||
|
Reference in New Issue
Block a user