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:
Joel Sherrill
2009-06-30 17:50:15 +00:00
parent b4e5a61914
commit 94ccbb7b3d
3 changed files with 25 additions and 2 deletions

View File

@@ -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>
* psx05/init.c, psx05/psx05.scn: Add test case for process scope now

View File

@@ -73,6 +73,8 @@ WriteThread - pthread_rwlock_wrlock(RWLock) unblocked -- OK
clock_gettime(CLOCK_REALTIME, &abstime) -- OK
pthread_rwlock_timedwrlock( &RWLock, &abstime) -- 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
*** END OF POSIX RWLOCK TEST 01 ***

View File

@@ -328,6 +328,7 @@ int main(
status = pthread_rwlock_destroy( &RWLock );
assert( status == EBUSY );
/* now unlock it so the threads can continue */
puts( "pthread_rwlock_unlock(RWLock) -- OK" );
status = pthread_rwlock_unlock(&RWLock);
assert( !status );
@@ -369,10 +370,24 @@ int main(
assert( status == 0 );
abstime.tv_sec += 1;
puts( "pthread_rwlock_timedrdlock( &RWLock, &abstime) -- OK" );
puts( "pthread_rwlock_timedrdlock( &RWLock, &abstime) -- ETIMEDOUT" );
status = pthread_rwlock_timedrdlock( &RWLock, &abstime );
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 ***************/
puts( "pthread_rwlock_destroy( &RWLock ) -- OK" );
status = pthread_rwlock_destroy( &RWLock );