mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-24 02:34:50 +08:00
2011-08-04 Joel Sherrill <joel.sherrill@oarcorp.com>
* psxtmrwlock03/init.c: Fix abstime issue. Time is now reasonable.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user