From 06974b302eaf8f08382e6e786aea53f420c12222 Mon Sep 17 00:00:00 2001 From: rpj Date: Fri, 6 Jul 2001 18:16:50 +0000 Subject: 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. --- condvar.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'condvar.c') diff --git a/condvar.c b/condvar.c index 57beefd..1f2de22 100644 --- a/condvar.c +++ b/condvar.c @@ -152,7 +152,7 @@ #include "pthread.h" #include "implement.h" -static int +static INLINE int ptw32_cond_check_need_init (pthread_cond_t *cond) { int result = 0; @@ -187,7 +187,7 @@ ptw32_cond_check_need_init (pthread_cond_t *cond) * re-initialise it only by calling pthread_cond_init() * explicitly. */ - if (*cond == (pthread_cond_t) PTW32_OBJECT_AUTO_INIT) + if (*cond == PTHREAD_COND_INITIALIZER) { result = pthread_cond_init(cond, NULL); } @@ -584,7 +584,7 @@ pthread_cond_destroy (pthread_cond_t * cond) return EINVAL; } - if (*cond != (pthread_cond_t) PTW32_OBJECT_AUTO_INIT) + if (*cond != PTHREAD_COND_INITIALIZER) { cv = *cond; @@ -649,7 +649,7 @@ pthread_cond_destroy (pthread_cond_t * cond) /* * Check again. */ - if (*cond == (pthread_cond_t) PTW32_OBJECT_AUTO_INIT) + if (*cond == PTHREAD_COND_INITIALIZER) { /* * This is all we need to do to destroy a statically @@ -827,7 +827,7 @@ ptw32_cond_timedwait (pthread_cond_t * cond, * again inside the guarded section of ptw32_cond_check_need_init() * to avoid race conditions. */ - if (*cond == (pthread_cond_t) PTW32_OBJECT_AUTO_INIT) + if (*cond == PTHREAD_COND_INITIALIZER) { result = ptw32_cond_check_need_init(cond); } @@ -950,7 +950,7 @@ ptw32_cond_unblock (pthread_cond_t * cond, * No-op if the CV is static and hasn't been initialised yet. * Assuming that any race condition is harmless. */ - if (cv == (pthread_cond_t) PTW32_OBJECT_AUTO_INIT) + if (cv == PTHREAD_COND_INITIALIZER) { return 0; } -- cgit v1.2.3