BIND 10 trac2202, updated. 408728e4512f08c8e50e3f627cc46eb6ad38a315 [2202] Assert instead of throw
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Oct 2 08:45:32 UTC 2012
The branch, trac2202 has been updated
via 408728e4512f08c8e50e3f627cc46eb6ad38a315 (commit)
from 1943079713265d5ad64762b107288b6e501c70cf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 408728e4512f08c8e50e3f627cc46eb6ad38a315
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue Oct 2 10:43:09 2012 +0200
[2202] Assert instead of throw
So we don't throw from a destructor. This should never happen anyway.
-----------------------------------------------------------------------
Summary of changes:
src/lib/util/threads/lock.cc | 4 +---
src/lib/util/threads/lock.h | 13 +++++--------
2 files changed, 6 insertions(+), 11 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/util/threads/lock.cc b/src/lib/util/threads/lock.cc
index a1434e1..de7bf07 100644
--- a/src/lib/util/threads/lock.cc
+++ b/src/lib/util/threads/lock.cc
@@ -124,9 +124,7 @@ Mutex::unlock() {
assert(impl_ != NULL);
--impl_->locked_count; // Only in debug mode
const int result = pthread_mutex_unlock(&impl_->mutex);
- if (result != 0) {
- isc_throw(isc::InvalidOperation, strerror(result));
- }
+ assert(result == 0); // This should never be possible
}
// TODO: Disable in non-debug build
diff --git a/src/lib/util/threads/lock.h b/src/lib/util/threads/lock.h
index 3717bd4..fef537b 100644
--- a/src/lib/util/threads/lock.h
+++ b/src/lib/util/threads/lock.h
@@ -33,10 +33,11 @@ namespace thread {
///
/// Also, as mutex is a low-level system object, an error might happen at any
/// operation with it. We convert many errors to the isc::InvalidOperation,
-/// since the errors usually happen only when used in a wrong way. Any methods,
-/// constructors or even destructors in this class can throw. Allocation errors
-/// are converted to std::bad_alloc (for example when OS-dependant limit of
-/// mutexes is exceeded).
+/// since the errors usually happen only when used in a wrong way. Any methods
+/// or constructors in this class can throw. Allocation errors are converted
+/// to std::bad_alloc (for example when OS-dependant limit of mutexes is
+/// exceeded). Some errors which usually mean a programmer error abort the
+/// program, since there could be no safe way to recover from them.
///
/// The current interface is somewhat minimalistic. If we ever need more, we
/// can add it later.
@@ -96,10 +97,6 @@ public:
/// \brief Destructor.
///
/// Unlocks the mutex.
- ///
- /// \throw isc::InvalidOperation when OS reports error. This usually
- /// means an attempt to use the mutex in a wrong way (unlocking
- /// a mutex belonging to a differen thread).
~Locker() {
if (mutex_ != NULL) {
mutex_->unlock();
More information about the bind10-changes
mailing list