diff options
author | rpj <rpj> | 2011-03-24 23:33:14 +0000 |
---|---|---|
committer | rpj <rpj> | 2011-03-24 23:33:14 +0000 |
commit | db171f2f9435b98f05f33fcbc0dcf0c5cc1cb917 (patch) | |
tree | 9d617a20a9e0ad1fcf415e353057c53e6d77d0f3 /pthread_mutex_destroy.c | |
parent | e5229a33f8724a90cbb0b56c3ecc1d6691bf54d7 (diff) |
First pass of robust mutexes
Diffstat (limited to 'pthread_mutex_destroy.c')
-rw-r--r-- | pthread_mutex_destroy.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pthread_mutex_destroy.c b/pthread_mutex_destroy.c index c9460dc..7b8c9cd 100644 --- a/pthread_mutex_destroy.c +++ b/pthread_mutex_destroy.c @@ -61,7 +61,7 @@ pthread_mutex_destroy (pthread_mutex_t * mutex) * If trylock succeeded and the mutex is not recursively locked it * can be destroyed. */ - if (result == 0) + if (0 == result || ENOTRECOVERABLE == result) { if (mx->kind != PTHREAD_MUTEX_RECURSIVE || 1 == mx->recursive_count) { @@ -74,10 +74,14 @@ pthread_mutex_destroy (pthread_mutex_t * mutex) */ *mutex = NULL; - result = pthread_mutex_unlock (&mx); + result = (0 == result)?pthread_mutex_unlock(&mx):0; - if (result == 0) + if (0 == result) { + if (mx->robustNode != NULL) + { + free(mx->robustNode); + } if (!CloseHandle (mx->event)) { *mutex = mx; |