From 8e60ba90e0a6b9c33bfb92eae674aeb52dbaf768 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Tue, 17 Apr 2001 04:07:38 +0000 Subject: [PATCH] unlock the mutex when non-blocking locking is attempted and the lock is busy. --- lib/isc/rwlock.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/isc/rwlock.c b/lib/isc/rwlock.c index ee728fe999..028080f864 100644 --- a/lib/isc/rwlock.c +++ b/lib/isc/rwlock.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rwlock.c,v 1.30 2001/03/08 19:52:13 halley Exp $ */ +/* $Id: rwlock.c,v 1.31 2001/04/17 04:07:38 tale Exp $ */ #include @@ -154,7 +154,8 @@ doit(isc_rwlock_t *rwl, isc_rwlocktype_t type, isc_boolean_t nonblock) { rwl->granted++; done = ISC_TRUE; } else if (nonblock) { - return (ISC_R_LOCKBUSY); + result = ISC_R_LOCKBUSY; + done = ISC_TRUE; } else { skip = ISC_FALSE; rwl->readers_waiting++; @@ -172,7 +173,8 @@ doit(isc_rwlock_t *rwl, isc_rwlocktype_t type, isc_boolean_t nonblock) { rwl->granted++; done = ISC_TRUE; } else if (nonblock) { - return (ISC_R_LOCKBUSY); + result = ISC_R_LOCKBUSY; + done = ISC_TRUE; } else { skip = ISC_FALSE; rwl->writers_waiting++; @@ -189,7 +191,7 @@ doit(isc_rwlock_t *rwl, isc_rwlocktype_t type, isc_boolean_t nonblock) { UNLOCK(&rwl->lock); - return (ISC_R_SUCCESS); + return (result); } isc_result_t