summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psx10/init.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-08-04 14:39:45 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-08-04 14:39:45 +0000
commitdecb0759ada70bc59e1e3befb9a74f974622f1a0 (patch)
tree34833be000b99cb0db86f7a3bb8c4545e9e56213 /testsuites/psxtests/psx10/init.c
parent2008-08-03 Ralf Corsépius <ralf.corsepius@rtems.org> (diff)
downloadrtems-decb0759ada70bc59e1e3befb9a74f974622f1a0.tar.bz2
2008-08-04 Tim FitzGeorge <tim.fitzgeorge@astrium.eads.net>
PR 1293/tests * psx10/init.c: Make sure we do not let tv_nsec go to -1.
Diffstat (limited to '')
-rw-r--r--testsuites/psxtests/psx10/init.c11
1 files changed, 8 insertions, 3 deletions
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 );