diff options
Diffstat (limited to 'mutex.c')
-rw-r--r-- | mutex.c | 30 |
1 files changed, 7 insertions, 23 deletions
@@ -66,7 +66,7 @@ _mutex_check_need_init(pthread_mutex_t *mutex) * re-initialise it only by calling pthread_mutex_init() * explicitly. */ - if (*mutex == (pthread_mutex_t) _PTHREAD_OBJECT_AUTO_INIT) + if (*mutex == (pthread_mutex_t) PTW32_OBJECT_AUTO_INIT) { result = pthread_mutex_init(mutex, NULL); } @@ -140,7 +140,7 @@ pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) } else { - if (ptw32_ry_enter_critical_section != NULL + if (ptw32_try_enter_critical_section != NULL || (attr != NULL && *attr != NULL && (*attr)->forcecs == 1) @@ -209,7 +209,7 @@ pthread_mutex_destroy(pthread_mutex_t *mutex) /* * Check to see if we have something to delete. */ - if (*mutex != (pthread_mutex_t) _PTHREAD_OBJECT_AUTO_INIT) + if (*mutex != (pthread_mutex_t) PTW32_OBJECT_AUTO_INIT) { mx = *mutex; @@ -239,7 +239,7 @@ pthread_mutex_destroy(pthread_mutex_t *mutex) /* * Check again. */ - if (*mutex == (pthread_mutex_t) _PTHREAD_OBJECT_AUTO_INIT) + if (*mutex == (pthread_mutex_t) PTW32_OBJECT_AUTO_INIT) { /* * This is all we need to do to destroy a statically @@ -355,22 +355,6 @@ pthread_mutexattr_destroy (pthread_mutexattr_t * attr) int -pthread_mutexattr_setforcecs_np(pthread_mutexattr_t *attr, - int forcecs) -{ - if (attr == NULL || *attr == NULL) - { - /* This is disallowed. */ - return EINVAL; - } - - (*attr)->forcecs = forcecs; - - return 0; -} - - -int pthread_mutexattr_getpshared (const pthread_mutexattr_t * attr, int *pshared) /* @@ -528,7 +512,7 @@ pthread_mutex_lock(pthread_mutex_t *mutex) * again inside the guarded section of _mutex_check_need_init() * to avoid race conditions. */ - if (*mutex == (pthread_mutex_t) _PTHREAD_OBJECT_AUTO_INIT) + if (*mutex == (pthread_mutex_t) PTW32_OBJECT_AUTO_INIT) { result = _mutex_check_need_init(mutex); } @@ -571,7 +555,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) _PTHREAD_OBJECT_AUTO_INIT) + if (mx != (pthread_mutex_t) PTW32_OBJECT_AUTO_INIT) { if (mx->mutex == 0) { @@ -607,7 +591,7 @@ pthread_mutex_trylock(pthread_mutex_t *mutex) * again inside the guarded section of _mutex_check_need_init() * to avoid race conditions. */ - if (*mutex == (pthread_mutex_t) _PTHREAD_OBJECT_AUTO_INIT) + if (*mutex == (pthread_mutex_t) PTW32_OBJECT_AUTO_INIT) { result = _mutex_check_need_init(mutex); } |