Allow immediate return on initial spins

This commit is contained in:
Keith Winstein
2012-03-21 18:00:36 -04:00
parent 19884d6c85
commit ec0c8c8984
+6
View File
@@ -74,12 +74,18 @@ void print_usage( const char *argv0 )
fprintf( stderr, "Usage: %s new [-s] [-i LOCALADDR] [-p PORT] [-- COMMAND...]\n", argv0 ); fprintf( stderr, "Usage: %s new [-s] [-i LOCALADDR] [-p PORT] [-- COMMAND...]\n", argv0 );
} }
/* Simple spinloop */
void spin( void ) void spin( void )
{ {
static unsigned int spincount = 0;
spincount++;
if ( spincount > 10 ) {
struct timespec req; struct timespec req;
req.tv_sec = 0; req.tv_sec = 0;
req.tv_nsec = 100000000; /* 0.1 sec */ req.tv_nsec = 100000000; /* 0.1 sec */
nanosleep( &req, NULL ); nanosleep( &req, NULL );
}
} }
string get_SSH_IP( void ) string get_SSH_IP( void )