2009-07-01 Santosh G Vattam <vattam.santosh@gmail.com>

* psxrwlock01/psxrwlock01.scn, psxrwlock01/test.c: Add test case for
	obtaining rwlock for write with a timed lock operation when the
	abstime timeout is in the past.
This commit is contained in:
Joel Sherrill
2009-07-01 16:15:21 +00:00
parent d852e2342b
commit f9ff8cea68
3 changed files with 22 additions and 0 deletions

View File

@@ -1,3 +1,9 @@
2009-07-01 Santosh G Vattam <vattam.santosh@gmail.com>
* psxrwlock01/psxrwlock01.scn, psxrwlock01/test.c: Add test case for
obtaining rwlock for write with a timed lock operation when the
abstime timeout is in the past.
2009-06-30 Joel Sherrill <joel.sherrill@OARcorp.com>
* psxrwlock01/psxrwlock01.scn, psxrwlock01/test.c: Add test case for

View File

@@ -75,6 +75,8 @@ pthread_rwlock_timedwrlock( &RWLock, &abstime) -- OK
WriteThread - pthread_rwlock_unlock(RWLock) -- OK
pthread_rwlock_timedrdlock( &RWLock, &abstime) -- ETIMEDOUT
pthread_rwlock_timedrdlock( &RWLock, &abstime) -- ETIMEDOUT
pthread_rwlock_timedwrlock( &RWLock, &abstime) -- ETIMEDOUT
pthread_rwlock_timedrdlock( &RWLock, &abstime) -- in past -- OK
pthread_rwlock_timedwrlock( &RWLock, &abstime) -- in past -- OK
pthread_rwlock_destroy( &RWLock ) -- OK
*** END OF POSIX RWLOCK TEST 01 ***

View File

@@ -379,6 +379,11 @@ int main(
status = pthread_rwlock_timedrdlock( &RWLock, &abstime );
assert( status == ETIMEDOUT );
abstime.tv_sec -= 1;
puts( "pthread_rwlock_timedwrlock( &RWLock, &abstime) -- ETIMEDOUT" );
status = pthread_rwlock_timedwrlock( &RWLock, &abstime );
assert( status == ETIMEDOUT );
/*************** OBTAIN RWLOCK WITH ABSTIME IN PAST ***************/
status = pthread_rwlock_unlock(&RWLock);
assert( !status );
@@ -388,6 +393,15 @@ int main(
status = pthread_rwlock_timedrdlock( &RWLock, &abstime );
assert( status == 0 );
/*************** OBTAIN RWLOCK FOR WRITE WITH ABSTIME IN PAST ***************/
status = pthread_rwlock_unlock(&RWLock);
assert( !status );
abstime.tv_sec -= 1;
puts( "pthread_rwlock_timedwrlock( &RWLock, &abstime) -- in past -- OK" );
status = pthread_rwlock_timedwrlock( &RWLock, &abstime );
assert( status == 0 );
/*************** DESTROY RWLOCK ***************/
puts( "pthread_rwlock_destroy( &RWLock ) -- OK" );
status = pthread_rwlock_destroy( &RWLock );