diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-07-01 16:15:21 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-07-01 16:15:21 +0000 |
commit | f9ff8cea68a7884a2dd88fa71270570750351ef2 (patch) | |
tree | 01e6d22b21a08fe69b5c5192bf23acfae447f1c1 /testsuites/psxtests/psxrwlock01 | |
parent | 2009-06-30 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-f9ff8cea68a7884a2dd88fa71270570750351ef2.tar.bz2 |
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.
Diffstat (limited to 'testsuites/psxtests/psxrwlock01')
-rw-r--r-- | testsuites/psxtests/psxrwlock01/psxrwlock01.scn | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxrwlock01/test.c | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/testsuites/psxtests/psxrwlock01/psxrwlock01.scn b/testsuites/psxtests/psxrwlock01/psxrwlock01.scn index 4f563d7a70..4a4c7d05a8 100644 --- a/testsuites/psxtests/psxrwlock01/psxrwlock01.scn +++ b/testsuites/psxtests/psxrwlock01/psxrwlock01.scn @@ -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 *** diff --git a/testsuites/psxtests/psxrwlock01/test.c b/testsuites/psxtests/psxrwlock01/test.c index 75f84eab66..404385e9a3 100644 --- a/testsuites/psxtests/psxrwlock01/test.c +++ b/testsuites/psxtests/psxrwlock01/test.c @@ -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 ); |