newlib/winsup/testsuite/winsup.api/pthread/rwlock2.c
Thomas Pfaff c65b504859 * winsup.api/pthread/rwlock1.c: Remove pthreads-win32 header.
* winsup.api/pthread/rwlock2.c: Ditto.
* winsup.api/pthread/rwlock3.c: Ditto.
* winsup.api/pthread/rwlock4.c: Ditto.
* winsup.api/pthread/rwlock5.c: Ditto.
* winsup.api/pthread/rwlock6.c: Ditto.
2003-03-27 19:46:35 +00:00

35 lines
585 B
C

/*
* rwlock2.c
*
* Declare a static rwlock object, lock it,
* and then unlock it again.
*
* Depends on API functions:
* pthread_rwlock_rdlock()
* pthread_rwlock_unlock()
*/
#include "test.h"
pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
int
main()
{
assert(rwlock == PTHREAD_RWLOCK_INITIALIZER);
assert(pthread_rwlock_rdlock(&rwlock) == 0);
assert(rwlock != PTHREAD_RWLOCK_INITIALIZER);
assert(rwlock != NULL);
assert(pthread_rwlock_unlock(&rwlock) == 0);
assert(pthread_rwlock_destroy(&rwlock) == 0);
assert(rwlock == NULL);
return 0;
}