nanosleep no longer consider a negative value of tv_sec to be an error.

Instead it is an indication of a request for a small delay.
This commit is contained in:
Joel Sherrill
1996-09-05 20:03:19 +00:00
parent 62bf651fe5
commit f254b93fd8
2 changed files with 14 additions and 12 deletions

View File

@@ -113,12 +113,6 @@ void *POSIX_Init(
assert( status == -1 ); assert( status == -1 );
assert( errno == EINVAL ); assert( errno == EINVAL );
tv.tv_sec = -1;
puts( "Init: nanosleep - EAGAIN (negative seconds)" );
status = nanosleep ( &tv, &tr );
assert( status == -1 );
assert( errno == EAGAIN );
tv.tv_sec = 0; tv.tv_sec = 0;
tv.tv_nsec = TOD_NANOSECONDS_PER_SECOND * 2; tv.tv_nsec = TOD_NANOSECONDS_PER_SECOND * 2;
puts( "Init: nanosleep - EINVAL (too many nanoseconds)" ); puts( "Init: nanosleep - EINVAL (too many nanoseconds)" );
@@ -126,6 +120,13 @@ void *POSIX_Init(
assert( status == -1 ); assert( status == -1 );
assert( errno == EINVAL ); assert( errno == EINVAL );
/* this is actually a small delay or yield */
tv.tv_sec = -1;
tv.tv_nsec = 0;
puts( "Init: nanosleep - negative seconds small delay " );
status = nanosleep ( &tv, &tr );
assert( !status );
/* use nanosleep to yield */ /* use nanosleep to yield */
tv.tv_sec = 0; tv.tv_sec = 0;

View File

@@ -113,12 +113,6 @@ void *POSIX_Init(
assert( status == -1 ); assert( status == -1 );
assert( errno == EINVAL ); assert( errno == EINVAL );
tv.tv_sec = -1;
puts( "Init: nanosleep - EAGAIN (negative seconds)" );
status = nanosleep ( &tv, &tr );
assert( status == -1 );
assert( errno == EAGAIN );
tv.tv_sec = 0; tv.tv_sec = 0;
tv.tv_nsec = TOD_NANOSECONDS_PER_SECOND * 2; tv.tv_nsec = TOD_NANOSECONDS_PER_SECOND * 2;
puts( "Init: nanosleep - EINVAL (too many nanoseconds)" ); puts( "Init: nanosleep - EINVAL (too many nanoseconds)" );
@@ -126,6 +120,13 @@ void *POSIX_Init(
assert( status == -1 ); assert( status == -1 );
assert( errno == EINVAL ); assert( errno == EINVAL );
/* this is actually a small delay or yield */
tv.tv_sec = -1;
tv.tv_nsec = 0;
puts( "Init: nanosleep - negative seconds small delay " );
status = nanosleep ( &tv, &tr );
assert( !status );
/* use nanosleep to yield */ /* use nanosleep to yield */
tv.tv_sec = 0; tv.tv_sec = 0;