summaryrefslogtreecommitdiff
path: root/mutex.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 /mutex.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 'mutex.c')
-rw-r--r--mutex.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/mutex.c b/mutex.c
index 22a7e7b..09dbc2f 100644
--- a/mutex.c
+++ b/mutex.c
@@ -27,7 +27,7 @@
#include "implement.h"
-static int
+static INLINE int
ptw32_mutex_check_need_init(pthread_mutex_t *mutex)
{
int result = 0;
@@ -63,7 +63,7 @@ ptw32_mutex_check_need_init(pthread_mutex_t *mutex)
* re-initialise it only by calling pthread_mutex_init()
* explicitly.
*/
- if (*mutex == (pthread_mutex_t) PTW32_OBJECT_AUTO_INIT)
+ if (*mutex == PTHREAD_MUTEX_INITIALIZER)
{
result = pthread_mutex_init(mutex, NULL);
}
@@ -170,7 +170,7 @@ pthread_mutex_destroy(pthread_mutex_t *mutex)
/*
* Check to see if we have something to delete.
*/
- if (*mutex != (pthread_mutex_t) PTW32_OBJECT_AUTO_INIT)
+ if (*mutex != PTHREAD_MUTEX_INITIALIZER)
{
mx = *mutex;
@@ -225,7 +225,7 @@ pthread_mutex_destroy(pthread_mutex_t *mutex)
/*
* Check again.
*/
- if (*mutex == (pthread_mutex_t) PTW32_OBJECT_AUTO_INIT)
+ if (*mutex == PTHREAD_MUTEX_INITIALIZER)
{
/*
* This is all we need to do to destroy a statically
@@ -630,7 +630,7 @@ pthread_mutex_lock(pthread_mutex_t *mutex)
* again inside the guarded section of ptw32_mutex_check_need_init()
* to avoid race conditions.
*/
- if (*mutex == (pthread_mutex_t) PTW32_OBJECT_AUTO_INIT)
+ if (*mutex == PTHREAD_MUTEX_INITIALIZER)
{
if ((result = ptw32_mutex_check_need_init(mutex)) != 0)
{
@@ -694,7 +694,7 @@ pthread_mutex_unlock(pthread_mutex_t *mutex)
* race condition. If another thread holds the
* lock then we shouldn't be in here.
*/
- if (mx != (pthread_mutex_t) PTW32_OBJECT_AUTO_INIT)
+ if (mx != PTHREAD_MUTEX_INITIALIZER)
{
if (mx->ownerThread == (pthread_t) PTW32_MUTEX_OWNER_ANONYMOUS
|| pthread_equal(mx->ownerThread, pthread_self()))
@@ -745,7 +745,7 @@ pthread_mutex_trylock(pthread_mutex_t *mutex)
* again inside the guarded section of ptw32_mutex_check_need_init()
* to avoid race conditions.
*/
- if (*mutex == (pthread_mutex_t) PTW32_OBJECT_AUTO_INIT)
+ if (*mutex == PTHREAD_MUTEX_INITIALIZER)
{
result = ptw32_mutex_check_need_init(mutex);
}