summaryrefslogtreecommitdiff
path: root/pthread_mutex_destroy.c
diff options
context:
space:
mode:
authorrpj <rpj>2002-12-11 00:40:17 +0000
committerrpj <rpj>2002-12-11 00:40:17 +0000
commit52c1047709bbc61fa793bcc6a28daabea88d2a20 (patch)
tree99cd6abc47bfcd0e2db847c447ff834f08d87907 /pthread_mutex_destroy.c
parentb5e1f8e4dcad0b58d7d2e27d7485fe5162154281 (diff)
2002-12-11 Thomas Pfaff <tpfaff@gmx.net>
* pthread_mutex_trylock.c: Should return EBUSY rather than EDEADLK. * pthread_mutex_destroy.c: Remove redundant ownership test (the trylock call does this for us); do not destroy a recursively locked mutex.
Diffstat (limited to 'pthread_mutex_destroy.c')
-rw-r--r--pthread_mutex_destroy.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/pthread_mutex_destroy.c b/pthread_mutex_destroy.c
index 22d78a1..e217bec 100644
--- a/pthread_mutex_destroy.c
+++ b/pthread_mutex_destroy.c
@@ -60,17 +60,10 @@ pthread_mutex_destroy(pthread_mutex_t *mutex)
result = pthread_mutex_trylock(&mx);
/*
- * The mutex type may not be RECURSIVE therefore trylock may return EBUSY if
- * we already own the mutex. Here we are assuming that it's OK to destroy
- * a mutex that we own and have locked recursively.
- *
- * For FAST mutexes we record the owner as ANONYMOUS for speed. In this
- * case we assume that the thread calling pthread_mutex_destroy() is the
- * owner, if the mutex is owned at all.
+ * If trylock succeeded and the mutex is not recursively locked it
+ * can be destroyed.
*/
- if (result == 0
- || mx->ownerThread == (pthread_t) PTW32_MUTEX_OWNER_ANONYMOUS
- || pthread_equal( mx->ownerThread, pthread_self() ) )
+ if (result == 0 && 1 == mx->recursive_count)
{
/*
* FIXME!!!