summaryrefslogtreecommitdiff
path: root/rwlock.c
diff options
context:
space:
mode:
authorrpj <rpj>2001-07-06 18:16:50 +0000
committerrpj <rpj>2001-07-06 18:16:50 +0000
commit06974b302eaf8f08382e6e786aea53f420c12222 (patch)
tree1b574a41dacc634a105a74127b2dac30a60bda13 /rwlock.c
parent7a3104dc65b469cbb9c88b6a9c7b7bea4126a43e (diff)
Spinlocks and barriers fixed and working. Beta level.
* spin.c: Revamped and working; included static initialiser. * barrier.c: Likewise. * condvar.c: Macro constant change; inline auto init routine. * mutex.c: Likewise. * rwlock.c: Likewise. * private.c: Add support for spinlock initialiser. * global.c: Likewise. * implement.h: Likewise. * pthread.h (PTHREAD_SPINLOCK_INITIALIZER): Fix typo. tests/ChangeLog: * spin3.c: Changed test and fixed. * spin4.c: Fixed. * barrier3.c: Fixed. * barrier4.c: Fixed.
Diffstat (limited to 'rwlock.c')
-rw-r--r--rwlock.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/rwlock.c b/rwlock.c
index 819507b..2cc94ce 100644
--- a/rwlock.c
+++ b/rwlock.c
@@ -29,7 +29,7 @@
#include "pthread.h"
#include "implement.h"
-static int
+static INLINE int
ptw32_rwlock_check_need_init(pthread_rwlock_t *rwlock)
{
int result = 0;
@@ -65,7 +65,7 @@ ptw32_rwlock_check_need_init(pthread_rwlock_t *rwlock)
* re-initialise it only by calling pthread_rwlock_init()
* explicitly.
*/
- if (*rwlock == (pthread_rwlock_t) PTW32_OBJECT_AUTO_INIT)
+ if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
{
result = pthread_rwlock_init(rwlock, NULL);
}
@@ -163,7 +163,7 @@ pthread_rwlock_destroy(pthread_rwlock_t *rwlock)
return EINVAL;
}
- if (*rwlock != (pthread_rwlock_t) PTW32_OBJECT_AUTO_INIT)
+ if (*rwlock != PTHREAD_RWLOCK_INITIALIZER)
{
rwl = *rwlock;
@@ -226,7 +226,7 @@ pthread_rwlock_destroy(pthread_rwlock_t *rwlock)
/*
* Check again.
*/
- if (*rwlock == (pthread_rwlock_t) PTW32_OBJECT_AUTO_INIT)
+ if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
{
/*
* This is all we need to do to destroy a statically
@@ -268,7 +268,7 @@ pthread_rwlock_rdlock(pthread_rwlock_t *rwlock)
* again inside the guarded section of ptw32_rwlock_check_need_init()
* to avoid race conditions.
*/
- if (*rwlock == (pthread_rwlock_t) PTW32_OBJECT_AUTO_INIT)
+ if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
{
result = ptw32_rwlock_check_need_init(rwlock);
@@ -340,7 +340,7 @@ pthread_rwlock_wrlock(pthread_rwlock_t * rwlock)
* again inside the guarded section of ptw32_rwlock_check_need_init()
* to avoid race conditions.
*/
- if (*rwlock == (pthread_rwlock_t) PTW32_OBJECT_AUTO_INIT)
+ if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
{
result = ptw32_rwlock_check_need_init(rwlock);
@@ -435,7 +435,7 @@ pthread_rwlock_unlock(pthread_rwlock_t * rwlock)
return(EINVAL);
}
- if (*rwlock == (pthread_rwlock_t) PTW32_OBJECT_AUTO_INIT)
+ if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
{
/*
* Assume any race condition here is harmless.
@@ -493,7 +493,7 @@ pthread_rwlock_tryrdlock(pthread_rwlock_t * rwlock)
* again inside the guarded section of ptw32_rwlock_check_need_init()
* to avoid race conditions.
*/
- if (*rwlock == (pthread_rwlock_t) PTW32_OBJECT_AUTO_INIT)
+ if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
{
result = ptw32_rwlock_check_need_init(rwlock);
@@ -553,7 +553,7 @@ pthread_rwlock_trywrlock(pthread_rwlock_t * rwlock)
* again inside the guarded section of ptw32_rwlock_check_need_init()
* to avoid race conditions.
*/
- if (*rwlock == (pthread_rwlock_t) PTW32_OBJECT_AUTO_INIT)
+ if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
{
result = ptw32_rwlock_check_need_init(rwlock);