From: Michal 'vorner' Vaner Date: Wed, 26 Sep 2012 09:20:40 +0000 (+0200) Subject: [2202] Cleanup: use better variable name X-Git-Tag: trac2402_base~79^2~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=076e5cff040e4da53df8dd60cee37a06e4e557c9;p=thirdparty%2Fkea.git [2202] Cleanup: use better variable name The previous looked like it should be boolean (there's something good about lisp's P suffix). --- diff --git a/src/lib/util/threads/lock.cc b/src/lib/util/threads/lock.cc index f15052e003..7c34baa56d 100644 --- a/src/lib/util/threads/lock.cc +++ b/src/lib/util/threads/lock.cc @@ -32,11 +32,11 @@ namespace thread { class Mutex::Impl { public: Impl() : - locked(0) + locked_count(0) {} pthread_mutex_t mutex; // Only in debug mode - size_t locked; + size_t locked_count; }; namespace { @@ -99,7 +99,7 @@ Mutex::Mutex(bool recursive) : Mutex::~Mutex() { if (impl_ != NULL) { const int result = pthread_mutex_destroy(&impl_->mutex); - const bool locked = impl_->locked != 0; + const bool locked = impl_->locked_count != 0; delete impl_; if (result != 0) { // Yes, really throwing from the destructor. @@ -121,13 +121,13 @@ Mutex::lock() { if (result != 0) { isc_throw(isc::InvalidOperation, strerror(result)); } - ++impl_->locked; // Only in debug mode + ++impl_->locked_count; // Only in debug mode } void Mutex::unlock() { assert(impl_ != NULL); - --impl_->locked; // Only in debug mode + --impl_->locked_count; // Only in debug mode const int result = pthread_mutex_unlock(&impl_->mutex); if (result != 0) { isc_throw(isc::InvalidOperation, strerror(result)); @@ -137,7 +137,7 @@ Mutex::unlock() { // TODO: Disable in non-debug build bool Mutex::locked() const { - return (impl_->locked != 0); + return (impl_->locked_count != 0); } }