diff options
-rw-r--r-- | implement.h | 2 | ||||
-rw-r--r-- | pthread_mutex_lock.c | 4 | ||||
-rw-r--r-- | pthread_mutex_timedlock.c | 4 | ||||
-rw-r--r-- | pthread_mutex_trylock.c | 2 | ||||
-rw-r--r-- | pthread_win32_attach_detach_np.c | 7 |
5 files changed, 9 insertions, 10 deletions
diff --git a/implement.h b/implement.h index 0b77d7d..1067bce 100644 --- a/implement.h +++ b/implement.h @@ -599,7 +599,7 @@ extern "C" int ptw32_mutex_check_need_init (pthread_mutex_t * mutex); int ptw32_rwlock_check_need_init (pthread_rwlock_t * rwlock); - int ptw32_robust_mutex_inherit(pthread_mutex_t * mutex, pthread_t self); + int ptw32_robust_mutex_inherit(pthread_mutex_t * mutex); #if 1 void ptw32_robust_mutex_add(pthread_mutex_t* mutex, pthread_t self); void ptw32_robust_mutex_remove(pthread_mutex_t* mutex); diff --git a/pthread_mutex_lock.c b/pthread_mutex_lock.c index fe58a05..eb81c9b 100644 --- a/pthread_mutex_lock.c +++ b/pthread_mutex_lock.c @@ -167,7 +167,7 @@ pthread_mutex_lock (pthread_mutex_t * mutex) (LPLONG) &mx->lock_idx, (LONG) 1) != 0) { - while (0 == (result = ptw32_robust_mutex_inherit(mutex, self)) + while (0 == (result = ptw32_robust_mutex_inherit(mutex)) && (LONG) PTW32_INTERLOCKED_EXCHANGE( (LPLONG) &mx->lock_idx, (LONG) -1) != 0) @@ -242,7 +242,7 @@ pthread_mutex_lock (pthread_mutex_t * mutex) } else { - while (0 == (result = ptw32_robust_mutex_inherit(mutex, self)) + while (0 == (result = ptw32_robust_mutex_inherit(mutex)) && (LONG) PTW32_INTERLOCKED_EXCHANGE( (LPLONG) &mx->lock_idx, (LONG) -1) != 0) diff --git a/pthread_mutex_timedlock.c b/pthread_mutex_timedlock.c index d81b9c3..d4c280d 100644 --- a/pthread_mutex_timedlock.c +++ b/pthread_mutex_timedlock.c @@ -223,7 +223,7 @@ pthread_mutex_timedlock (pthread_mutex_t * mutex, (LPLONG) &mx->lock_idx, (LONG) 1) != 0) { - while (0 == (result = ptw32_robust_mutex_inherit(mutex, self)) + while (0 == (result = ptw32_robust_mutex_inherit(mutex)) && (LONG) PTW32_INTERLOCKED_EXCHANGE( (LPLONG) &mx->lock_idx, (LONG) -1) != 0) @@ -296,7 +296,7 @@ pthread_mutex_timedlock (pthread_mutex_t * mutex, } else { - while (0 == (result = ptw32_robust_mutex_inherit(mutex, self)) + while (0 == (result = ptw32_robust_mutex_inherit(mutex)) && (LONG) PTW32_INTERLOCKED_EXCHANGE( (LPLONG) &mx->lock_idx, (LONG) -1) != 0) diff --git a/pthread_mutex_trylock.c b/pthread_mutex_trylock.c index 8f98661..f51c34c 100644 --- a/pthread_mutex_trylock.c +++ b/pthread_mutex_trylock.c @@ -138,7 +138,7 @@ pthread_mutex_trylock (pthread_mutex_t * mutex) } else { - if (EOWNERDEAD == (result = ptw32_robust_mutex_inherit(mutex, self))) + if (EOWNERDEAD == (result = ptw32_robust_mutex_inherit(mutex))) { mx->recursive_count = 1; #if 1 diff --git a/pthread_win32_attach_detach_np.c b/pthread_win32_attach_detach_np.c index 98935fb..d03b55f 100644 --- a/pthread_win32_attach_detach_np.c +++ b/pthread_win32_attach_detach_np.c @@ -209,11 +209,10 @@ pthread_win32_thread_detach_np () while (sp->robustMxList != NULL) { pthread_mutex_t mx = sp->robustMxList->mx; -#if 1 ptw32_robust_mutex_quick_remove(&mx, sp); -#else - ptw32_robust_mutex_quick_remove(&mx, sp); -#endif + (void) PTW32_INTERLOCKED_EXCHANGE( + (LPLONG)&mx->robustNode->stateInconsistent, + -1L); /* * If there are no waiters then the next thread to block will * sleep, wakeup immediately and then go back to sleep. |