diff options
Diffstat (limited to 'lib/isc/rwlock.c')
-rw-r--r-- | lib/isc/rwlock.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/isc/rwlock.c b/lib/isc/rwlock.c index 69b8f56d94c5..4bb0edf1efb2 100644 --- a/lib/isc/rwlock.c +++ b/lib/isc/rwlock.c @@ -1,8 +1,8 @@ /* - * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2009 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2001, 2003 Internet Software Consortium. * - * Permission to use, copy, modify, and distribute this software for any + * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rwlock.c,v 1.37.18.5 2005/07/12 01:22:30 marka Exp $ */ +/* $Id: rwlock.c,v 1.37.18.7 2009/01/19 23:46:16 tbox Exp $ */ /*! \file */ @@ -45,7 +45,7 @@ #ifdef ISC_RWLOCK_TRACE #include <stdio.h> /* Required for fprintf/stderr. */ -#include <isc/thread.h> /* Requried for isc_thread_self(). */ +#include <isc/thread.h> /* Required for isc_thread_self(). */ static void print_lock(const char *operation, isc_rwlock_t *rwl, isc_rwlocktype_t type) { @@ -55,17 +55,17 @@ print_lock(const char *operation, isc_rwlock_t *rwl, isc_rwlocktype_t type) { "rwlock %p thread %lu %s(%s): %s, %u active, " "%u granted, %u rwaiting, %u wwaiting\n"), rwl, isc_thread_self(), operation, - (type == isc_rwlocktype_read ? + (type == isc_rwlocktype_read ? isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK, ISC_MSG_READ, "read") : isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK, ISC_MSG_WRITE, "write")), - (rwl->type == isc_rwlocktype_read ? + (rwl->type == isc_rwlocktype_read ? isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK, - ISC_MSG_READING, "reading") : + ISC_MSG_READING, "reading") : isc_msgcat_get(isc_msgcat, ISC_MSGSET_RWLOCK, ISC_MSG_WRITING, "writing")), - rwl->active, rwl->granted, rwl->readers_waiting, + rwl->active, rwl->granted, rwl->readers_waiting, rwl->writers_waiting); } #endif @@ -381,7 +381,7 @@ isc_rwlock_trylock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { BROADCAST(&rwl->writeable); UNLOCK(&rwl->lock); } - + return (ISC_R_LOCKBUSY); } } else { @@ -434,7 +434,7 @@ isc_rwlock_tryupgrade(isc_rwlock_t *rwl) { return (ISC_R_LOCKBUSY); return (ISC_R_SUCCESS); - + } void @@ -555,7 +555,7 @@ doit(isc_rwlock_t *rwl, isc_rwlocktype_t type, isc_boolean_t nonblock) { ((rwl->active == 0 || (rwl->type == isc_rwlocktype_read && (rwl->writers_waiting == 0 || - rwl->granted < rwl->read_quota))))) + rwl->granted < rwl->read_quota))))) { rwl->type = isc_rwlocktype_read; rwl->active++; @@ -751,7 +751,7 @@ isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { rwl->type = isc_rwlocktype_write; rwl->active = 1; } - return (ISC_R_SUCCESS); + return (ISC_R_SUCCESS); } isc_result_t @@ -766,7 +766,7 @@ isc_rwlock_tryupgrade(isc_rwlock_t *rwl) { REQUIRE(VALID_RWLOCK(rwl)); REQUIRE(rwl->type == isc_rwlocktype_read); REQUIRE(rwl->active != 0); - + /* If we are the only reader then succeed. */ if (rwl->active == 1) rwl->type = isc_rwlocktype_write; |