From 52c1047709bbc61fa793bcc6a28daabea88d2a20 Mon Sep 17 00:00:00 2001 From: rpj Date: Wed, 11 Dec 2002 00:40:17 +0000 Subject: 2002-12-11 Thomas Pfaff * 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. --- pthread_mutex_trylock.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'pthread_mutex_trylock.c') 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; + } } } -- cgit v1.2.3