mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 07:05:45 +00:00
2009-06-30 Joel Sherrill <joel.sherrill@OARcorp.com>
* psxrwlock01/psxrwlock01.scn, psxrwlock01/test.c: Add test case for obtaining rwlock for read with a timed lock operation when the abstime timeout is in the past.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2009-06-30 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||||
|
|
||||||
|
* psxrwlock01/psxrwlock01.scn, psxrwlock01/test.c: Add test case for
|
||||||
|
obtaining rwlock for read with a timed lock operation when the
|
||||||
|
abstime timeout is in the past.
|
||||||
|
|
||||||
2009-06-29 Joel Sherrill <joel.sherrill@oarcorp.com>
|
2009-06-29 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
* psx05/init.c, psx05/psx05.scn: Add test case for process scope now
|
* psx05/init.c, psx05/psx05.scn: Add test case for process scope now
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ WriteThread - pthread_rwlock_wrlock(RWLock) unblocked -- OK
|
|||||||
clock_gettime(CLOCK_REALTIME, &abstime) -- OK
|
clock_gettime(CLOCK_REALTIME, &abstime) -- OK
|
||||||
pthread_rwlock_timedwrlock( &RWLock, &abstime) -- OK
|
pthread_rwlock_timedwrlock( &RWLock, &abstime) -- OK
|
||||||
WriteThread - pthread_rwlock_unlock(RWLock) -- OK
|
WriteThread - pthread_rwlock_unlock(RWLock) -- OK
|
||||||
pthread_rwlock_timedrdlock( &RWLock, &abstime) -- OK
|
pthread_rwlock_timedrdlock( &RWLock, &abstime) -- ETIMEDOUT
|
||||||
|
pthread_rwlock_timedrdlock( &RWLock, &abstime) -- ETIMEDOUT
|
||||||
|
pthread_rwlock_timedrdlock( &RWLock, &abstime) -- in past -- OK
|
||||||
pthread_rwlock_destroy( &RWLock ) -- OK
|
pthread_rwlock_destroy( &RWLock ) -- OK
|
||||||
*** END OF POSIX RWLOCK TEST 01 ***
|
*** END OF POSIX RWLOCK TEST 01 ***
|
||||||
|
|||||||
@@ -328,6 +328,7 @@ int main(
|
|||||||
status = pthread_rwlock_destroy( &RWLock );
|
status = pthread_rwlock_destroy( &RWLock );
|
||||||
assert( status == EBUSY );
|
assert( status == EBUSY );
|
||||||
|
|
||||||
|
/* now unlock it so the threads can continue */
|
||||||
puts( "pthread_rwlock_unlock(RWLock) -- OK" );
|
puts( "pthread_rwlock_unlock(RWLock) -- OK" );
|
||||||
status = pthread_rwlock_unlock(&RWLock);
|
status = pthread_rwlock_unlock(&RWLock);
|
||||||
assert( !status );
|
assert( !status );
|
||||||
@@ -369,10 +370,24 @@ int main(
|
|||||||
assert( status == 0 );
|
assert( status == 0 );
|
||||||
|
|
||||||
abstime.tv_sec += 1;
|
abstime.tv_sec += 1;
|
||||||
puts( "pthread_rwlock_timedrdlock( &RWLock, &abstime) -- OK" );
|
puts( "pthread_rwlock_timedrdlock( &RWLock, &abstime) -- ETIMEDOUT" );
|
||||||
status = pthread_rwlock_timedrdlock( &RWLock, &abstime );
|
status = pthread_rwlock_timedrdlock( &RWLock, &abstime );
|
||||||
assert( status == ETIMEDOUT );
|
assert( status == ETIMEDOUT );
|
||||||
|
|
||||||
|
abstime.tv_sec -= 1;
|
||||||
|
puts( "pthread_rwlock_timedrdlock( &RWLock, &abstime) -- ETIMEDOUT" );
|
||||||
|
status = pthread_rwlock_timedrdlock( &RWLock, &abstime );
|
||||||
|
assert( status == ETIMEDOUT );
|
||||||
|
|
||||||
|
/*************** OBTAIN RWLOCK WITH ABSTIME IN PAST ***************/
|
||||||
|
status = pthread_rwlock_unlock(&RWLock);
|
||||||
|
assert( !status );
|
||||||
|
|
||||||
|
abstime.tv_sec -= 1;
|
||||||
|
puts( "pthread_rwlock_timedrdlock( &RWLock, &abstime) -- in past -- OK" );
|
||||||
|
status = pthread_rwlock_timedrdlock( &RWLock, &abstime );
|
||||||
|
assert( status == 0 );
|
||||||
|
|
||||||
/*************** DESTROY RWLOCK ***************/
|
/*************** DESTROY RWLOCK ***************/
|
||||||
puts( "pthread_rwlock_destroy( &RWLock ) -- OK" );
|
puts( "pthread_rwlock_destroy( &RWLock ) -- OK" );
|
||||||
status = pthread_rwlock_destroy( &RWLock );
|
status = pthread_rwlock_destroy( &RWLock );
|
||||||
|
|||||||
Reference in New Issue
Block a user