From: Mukund Sivaraman Date: Sun, 21 Oct 2012 23:30:34 +0000 (+0530) Subject: [2198] Check pthread_mutex_trylock()'s return value X-Git-Tag: trac2402_base~10^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11df86c57f35ed344838b787ecc1caf1382805dc;p=thirdparty%2Fkea.git [2198] Check pthread_mutex_trylock()'s return value --- diff --git a/src/lib/util/threads/sync.cc b/src/lib/util/threads/sync.cc index db3cc33fb4..bcb391a79e 100644 --- a/src/lib/util/threads/sync.cc +++ b/src/lib/util/threads/sync.cc @@ -132,8 +132,10 @@ bool Mutex::tryLock() { assert(impl_ != NULL); const int result = pthread_mutex_trylock(&impl_->mutex); - if (result != 0) { + if (result == EBUSY) { return (false); + } else if (result != 0) { + isc_throw(isc::InvalidOperation, std::strerror(result)); } postLockAction(); // Only in debug mode return (true);