2011-08-04 Joel Sherrill <joel.sherrill@oarcorp.com>

* psxtmrwlock03/init.c: Fix abstime issue. Time is now reasonable.
This commit is contained in:
Joel Sherrill
2011-08-04 14:42:05 +00:00
parent d7314783e1
commit b61bb4f44c
2 changed files with 13 additions and 7 deletions
+4
View File
@@ -1,3 +1,7 @@
2011-08-04 Joel Sherrill <joel.sherrill@oarcorp.com>
* psxtmrwlock03/init.c: Fix abstime issue. Time is now reasonable.
2011-08-02 Ricardo Aguirre <el.mastin@ymail.com>
PR 1880/tests
+9 -7
View File
@@ -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.