diff options
author | rpj <rpj> | 2002-12-11 00:40:17 +0000 |
---|---|---|
committer | rpj <rpj> | 2002-12-11 00:40:17 +0000 |
commit | 52c1047709bbc61fa793bcc6a28daabea88d2a20 (patch) | |
tree | 99cd6abc47bfcd0e2db847c447ff834f08d87907 /pthread_mutex_trylock.c | |
parent | b5e1f8e4dcad0b58d7d2e27d7485fe5162154281 (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_trylock.c')
-rw-r--r-- | pthread_mutex_trylock.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/pthread_mutex_trylock.c b/pthread_mutex_trylock.c index 66eb96e..97f33cd 100644 --- a/pthread_mutex_trylock.c +++ b/pthread_mutex_trylock.c @@ -76,22 +76,15 @@ pthread_mutex_trylock(pthread_mutex_t *mutex) } else { - if( mx->kind != PTHREAD_MUTEX_FAST_NP && - pthread_equal( mx->ownerThread, pthread_self() ) ) - { - if( mx->kind == PTHREAD_MUTEX_RECURSIVE_NP ) - { - mx->recursive_count++; - } - else - { - result = EDEADLK; - } - } - else - { - result = EBUSY; - } + if( mx->kind == PTHREAD_MUTEX_RECURSIVE_NP && + pthread_equal( mx->ownerThread, pthread_self() ) ) + { + mx->recursive_count++; + } + else + { + result = EBUSY; + } } } |