From decb0759ada70bc59e1e3befb9a74f974622f1a0 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 4 Aug 2008 14:39:45 +0000 Subject: 2008-08-04 Tim FitzGeorge PR 1293/tests * psx10/init.c: Make sure we do not let tv_nsec go to -1. --- testsuites/psxtests/ChangeLog | 5 +++++ testsuites/psxtests/psx10/init.c | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'testsuites') diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog index 2b78e3defc..cbb9dddd65 100644 --- a/testsuites/psxtests/ChangeLog +++ b/testsuites/psxtests/ChangeLog @@ -1,3 +1,8 @@ +2008-08-04 Tim FitzGeorge + + PR 1293/tests + * psx10/init.c: Make sure we do not let tv_nsec go to -1. + 2008-07-18 Joel Sherrill PR 1291/cpukit diff --git a/testsuites/psxtests/psx10/init.c b/testsuites/psxtests/psx10/init.c index a9749e0087..2688e5d640 100644 --- a/testsuites/psxtests/psx10/init.c +++ b/testsuites/psxtests/psx10/init.c @@ -247,9 +247,14 @@ void *POSIX_Init( status = pthread_mutex_lock( &Mutex_id ); assert( !status ); - status = clock_gettime( CLOCK_REALTIME, &timeout ); - assert( !status ); - timeout.tv_nsec -= 1; + + /* ensure we do not catch a 0 nanosecond boundary */ + do { + status = clock_gettime( CLOCK_REALTIME, &timeout ); + assert( !status ); + timeout.tv_nsec -= 1; + } while ( timeout.tv_nsec < 0); + status = pthread_cond_timedwait( &Cond1_id, &Mutex_id, &timeout ); if ( status != ETIMEDOUT ) printf( "status = %d\n", status ); -- cgit v1.2.3