diff --git a/AUTHORS b/AUTHORS index 64b3f59..c495e5d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -26,3 +26,5 @@ John Estabrook Andrew Gallatin * threading fix and non Linux performance improvements +Stephen Hemminger + * Linux scheduler selection and theading improvements diff --git a/ChangeLog b/ChangeLog index 7e7125c..b6f415d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-03-19 Stephen Hemminger + +* Use sched_yield rather than usleep(0) as it behaves better on Linux + 2008-03-12 Jon Dugan * Rework Client::RunTCP so to update the stats for every packet if -i is set. diff --git a/compat/Thread.c b/compat/Thread.c index c2f2228..ad49538 100644 --- a/compat/Thread.c +++ b/compat/Thread.c @@ -405,9 +405,12 @@ int thread_numuserthreads( void ) { void thread_rest ( void ) { #if defined( HAVE_THREAD ) #if defined( HAVE_POSIX_THREAD ) - // TODO add checks for sched_yield or pthread_yield and call that - // if available +#if defined( _POSIX_PRIORITY_SCHEDULING ) + sched_yield(); +#else usleep( 0 ); +#endif + #else // Win32 SwitchToThread( ); #endif