From b61bb4f44c01cd7866dd89129995c9ede050ff24 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 4 Aug 2011 14:42:05 +0000 Subject: 2011-08-04 Joel Sherrill * psxtmrwlock03/init.c: Fix abstime issue. Time is now reasonable. --- testsuites/psxtmtests/ChangeLog | 4 ++++ testsuites/psxtmtests/psxtmrwlock03/init.c | 16 +++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'testsuites') diff --git a/testsuites/psxtmtests/ChangeLog b/testsuites/psxtmtests/ChangeLog index f275700ad0..8808d55851 100644 --- a/testsuites/psxtmtests/ChangeLog +++ b/testsuites/psxtmtests/ChangeLog @@ -1,3 +1,7 @@ +2011-08-04 Joel Sherrill + + * psxtmrwlock03/init.c: Fix abstime issue. Time is now reasonable. + 2011-08-02 Ricardo Aguirre PR 1880/tests diff --git a/testsuites/psxtmtests/psxtmrwlock03/init.c b/testsuites/psxtmtests/psxtmrwlock03/init.c index e6b901f610..b1c5448ff2 100644 --- a/testsuites/psxtmtests/psxtmrwlock03/init.c +++ b/testsuites/psxtmtests/psxtmrwlock03/init.c @@ -22,6 +22,7 @@ #include "test_support.h" pthread_rwlock_t rwlock; +struct timespec abstime; void *Low( void *argument @@ -58,10 +59,6 @@ void *Middle( ) { int status; - struct timespec abstime; - - abstime.tv_sec = 0; - abstime.tv_nsec = 0; /* * Now we have finished the thread startup overhead, @@ -74,9 +71,7 @@ void *Middle( /* this timed read lock operation will be blocked * cause a write operation has the lock */ status = pthread_rwlock_timedrdlock(&rwlock, &abstime); - /*status should be non zero, cause read lock is refused... - * blocked during abstime */ - rtems_test_assert( status == ETIMEDOUT ); + rtems_test_assert( status == 0 ); return NULL; } @@ -99,6 +94,13 @@ void *POSIX_Init( status = pthread_create( &threadId, NULL, Low, NULL ); rtems_test_assert( !status ); + /* + * Timeout for 5 seconds from now. + */ + status = clock_gettime( CLOCK_REALTIME, &abstime ); + rtems_test_assert( !status ); + abstime.tv_sec += 5; + /* * Deliberately create the rwlock after the threads. This way if the * threads do run before we intend, they will get an error. -- cgit v1.2.3