summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpj <rpj>2005-01-25 05:37:42 +0000
committerrpj <rpj>2005-01-25 05:37:42 +0000
commite1d015c3dc92a70d787a5686bc7518c6f42fe81f (patch)
treec4c9db3e27fd40a5ec8bb58735f4af3bac6b9dcf
parentf66968e00f75b86f48293f9aac0b1146feb5b48b (diff)
Recursive mutex bug fix
-rw-r--r--pthread_mutex_lock.c7
-rw-r--r--pthread_mutex_timedlock.c7
2 files changed, 8 insertions, 6 deletions
diff --git a/pthread_mutex_lock.c b/pthread_mutex_lock.c
index cb429ef..301f7bf 100644
--- a/pthread_mutex_lock.c
+++ b/pthread_mutex_lock.c
@@ -88,9 +88,10 @@ pthread_mutex_lock (pthread_mutex_t * mutex)
{
pthread_t self = pthread_self();
- if ((LONG) PTW32_INTERLOCKED_EXCHANGE(
- (LPLONG) &mx->lock_idx,
- (LONG) 1) == 0)
+ if ((PTW32_INTERLOCKED_LONG) PTW32_INTERLOCKED_COMPARE_EXCHANGE(
+ (PTW32_INTERLOCKED_LPLONG) &mx->lock_idx,
+ (PTW32_INTERLOCKED_LONG) 1,
+ (PTW32_INTERLOCKED_LONG) 0) == 0)
{
mx->recursive_count = 1;
mx->ownerThread = self;
diff --git a/pthread_mutex_timedlock.c b/pthread_mutex_timedlock.c
index b1b9d15..db45f45 100644
--- a/pthread_mutex_timedlock.c
+++ b/pthread_mutex_timedlock.c
@@ -222,9 +222,10 @@ pthread_mutex_timedlock (pthread_mutex_t * mutex,
{
pthread_t self = pthread_self();
- if ((LONG) PTW32_INTERLOCKED_EXCHANGE(
- (LPLONG) &mx->lock_idx,
- (LONG) 1) == 0)
+ if ((PTW32_INTERLOCKED_LONG) PTW32_INTERLOCKED_COMPARE_EXCHANGE(
+ (PTW32_INTERLOCKED_LPLONG) &mx->lock_idx,
+ (PTW32_INTERLOCKED_LONG) 1,
+ (PTW32_INTERLOCKED_LONG) 0) == 0)
{
mx->recursive_count = 1;
mx->ownerThread = self;