Allow immediate return on initial spins
This commit is contained in:
@@ -74,13 +74,19 @@ 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 )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user