summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpj <rpj>2011-03-25 02:53:23 +0000
committerrpj <rpj>2011-03-25 02:53:23 +0000
commitc31136724ab51c9b935344c46d3eca51c8b37d55 (patch)
tree66fb6cc81599defacdc4ef1ee6fd79c97ba92db2
parente2bee8c46a60d2f3e6bc3dfbb4f8549963060cb0 (diff)
Terminating thread robust signaling changes
-rw-r--r--implement.h2
-rw-r--r--pthread_mutex_lock.c4
-rw-r--r--pthread_mutex_timedlock.c4
-rw-r--r--pthread_mutex_trylock.c2
-rw-r--r--pthread_win32_attach_detach_np.c7
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.