]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2043] addressed comments
authorRazvan Becheriu <razvan@isc.org>
Wed, 25 Aug 2021 13:03:40 +0000 (16:03 +0300)
committerRazvan Becheriu <razvan@isc.org>
Wed, 25 Aug 2021 13:03:40 +0000 (16:03 +0300)
15 files changed:
src/hooks/dhcp/high_availability/ha_messages.mes
src/hooks/dhcp/high_availability/ha_service.cc
src/hooks/dhcp/high_availability/ha_service.h
src/hooks/dhcp/stat_cmds/stat_cmds.cc
src/lib/config/cmd_http_listener.h
src/lib/exceptions/exceptions.h
src/lib/http/client.cc
src/lib/http/client.h
src/lib/http/http_thread_pool.cc
src/lib/http/http_thread_pool.h
src/lib/http/tests/client_mt_unittests.cc
src/lib/util/multi_threading_mgr.cc
src/lib/util/multi_threading_mgr.h
src/lib/util/tests/multi_threading_mgr_unittest.cc
src/lib/util/thread_pool.h

index 7712c42567bfd0fad35d56fbe40dada629766629..25377955b672746505c971f2e5520dd6f2eeba77 100644 (file)
@@ -487,10 +487,10 @@ listener threads. This error is highly unlikely and indicates a programmatic
 issue that should be reported as a defect.
 
 % HA_PAUSE_CLIENT_LISTENER_ILLEGAL Pausing multi-threaded HTTP processing failed: %1
-This error message is emitted when attempting to pause HA's HTTP client and
-listener threads from owned thread. This error indicates that a command run on
-the listener threads is trying to use a critical section which would result in
-a dead-lock.
+This error message is emitted when attempting to pause HA's HTTP client or
+listener thread pools from a worker thread. This error indicates that a command
+run on the listener threads is trying to use a critical section which would
+result in a dead-lock.
 
 % HA_RESET_COMMUNICATIONS_FAILED failed to send ha-reset command to %1: %2
 This warning message indicates a problem with communication with a HA peer
index 033165d9a50f97ebb646f6de46ce423d034133ac..370262967fa8fa59cc1818b3fcea49ef3fc461d0 100644 (file)
@@ -2815,8 +2815,11 @@ HAService::getPendingRequestInternal(const QueryPtrType& query) {
 
 void
 HAService::checkPermissionsClientAndListener() {
-    // Since we're used as CS callback we need to suppress
-    // any exceptions, unlikely though they may be.
+    // Since this function is used as CS callback all exceptions must be
+    // suppressed (except the @ref MultiThreadingInvalidOperation), unlikely
+    // though they may be.
+    // The @ref MultiThreadingInvalidOperation is propagated to the scope of the
+    // @ref MultiThreadingCriticalSection constructor.
     try {
         if (client_) {
             client_->checkPermissions();
@@ -2856,8 +2859,8 @@ HAService::startClientAndListener() {
 
 void
 HAService::pauseClientAndListener() {
-    // Since we're used as CS callback we need to suppress
-    // any exceptions, unlikely though they may be.
+    // Since this function is used as CS callback all exceptions must be
+    // suppressed, unlikely though they may be.
     try {
         if (client_) {
             client_->pause();
@@ -2874,8 +2877,8 @@ HAService::pauseClientAndListener() {
 
 void
 HAService::resumeClientAndListener() {
-    // Since we're used as CS callback we need to suppress
-    // any exceptions, unlikely though they may be.
+    // Since this function is used as CS callback all exceptions must be
+    // suppressed, unlikely though they may be.
     try {
         if (client_) {
             client_->resume();
index 159b0f0e472202f0d208b5e1c514c02a55422381..8eaaefdd950fbae7347e7ca57b7a6e666337064c 100644 (file)
@@ -1006,7 +1006,7 @@ public:
     /// perform thread pool state transition.
     ///
     /// @throw MultiThreadingInvalidOperation if the state transition is done on
-    /// any of the owned threads
+    /// any of the worker threads.
     void checkPermissionsClientAndListener();
 
     /// @brief Start the client and(or) listener instances.
index c10c60997eaa611488856a3592d85cbdcd4da901..4f7ab86bab0e2f1df101c044af87420e9f5bc3e3 100644 (file)
@@ -678,7 +678,7 @@ int
 StatCmds::statLease4GetHandler(CalloutHandle& handle) {
     try {
         LeaseStatCmdsImpl impl;
-        MultiThreadingCriticalSection sc;
+        MultiThreadingCriticalSection cs;
         return (impl.statLease4GetHandler(handle));
     } catch (const std::exception& ex) {
 
@@ -692,7 +692,7 @@ int
 StatCmds::statLease6GetHandler(CalloutHandle& handle) {
     try {
         LeaseStatCmdsImpl impl;
-        MultiThreadingCriticalSection sc;
+        MultiThreadingCriticalSection cs;
         return (impl.statLease6GetHandler(handle));
     } catch (const std::exception& ex) {
 
index bc59d214d591951d3665754395d592430ef7e065..cee570be7acc9026a7934a6548519f6b6b263b26 100644 (file)
@@ -42,7 +42,7 @@ public:
     /// transition.
     ///
     /// @throw MultiThreadingInvalidOperation if the state transition is done on
-    /// any of the owned threads
+    /// any of the worker threads.
     void checkPermissions();
 
     /// @brief Starts running the listener's thread pool.
index 47adf96d9d0c2ee59fa20d67e10265e60bb32b0f..d07ae00f4278da664887a467ca58791a2455505b 100644 (file)
@@ -178,7 +178,7 @@ public:
         isc::Exception(file, line, what) {}
 };
 
-/// \brief Exception thrown when an owned thread is trying to stop or pause the
+/// \brief Exception thrown when a worker thread is trying to stop or pause the
 /// respective thread pool (which would result in a dead-lock).
 class MultiThreadingInvalidOperation : public Exception {
 public:
index 574049b150d52349bd8e4ddf65c4998d7ed65b7d..cfbf6630961b73295ce2bfa8ebeec30383184382 100644 (file)
@@ -1782,7 +1782,7 @@ public:
     /// transition.
     ///
     /// @throw MultiThreadingInvalidOperation if the state transition is done on
-    /// any of the owned threads
+    /// any of the worker threads.
     void checkPermissions() {
         if (thread_pool_) {
             thread_pool_->checkPausePermissions();
index 6670b7f73d46267b0c07b1538cce7b60cadc6511..69c441c1ed5e5690241197f7593e6529d094acd4 100644 (file)
@@ -253,7 +253,7 @@ public:
     /// transition.
     ///
     /// @throw MultiThreadingInvalidOperation if the state transition is done on
-    /// any of the owned threads
+    /// any of the worker threads.
     void checkPermissions();
 
     /// @brief Starts running the client's thread pool, if multi-threaded.
index f1dacda65ae560a05a40bd92863856c450375ff5..b0961b12bf44f7825ada24653117a052d4face6c 100644 (file)
@@ -111,7 +111,7 @@ HttpThreadPool::checkPermissions(State state) {
     auto id = std::this_thread::get_id();
     if (checkThreadId(id)) {
         isc_throw(MultiThreadingInvalidOperation, "invalid thread pool state change to "
-                  << HttpThreadPool::stateToText(state) << " performed by owned thread");
+                  << HttpThreadPool::stateToText(state) << " performed by worker thread");
     }
 }
 
index d28512200e846446efe2e501cdccc4a96fe51d4f..aa457dc0b7159fefbc911f0e88196842c348b774 100644 (file)
@@ -94,16 +94,26 @@ public:
 
     /// @brief Check current thread permissions to transition to the new PAUSED
     /// state.
+    ///
+    /// This function throws @ref MultiThreadingInvalidOperation if the calling
+    /// thread is one of the worker threads. This would prevent a dead-lock if
+    /// the calling thread would try to perform a thread pool state transition
+    /// to PAUSED state.
+    ///
     /// @throw MultiThreadingInvalidOperation if the state transition is done on
-    /// any of the owned threads
+    /// any of the worker threads.
     void checkPausePermissions();
 
 private:
     /// @brief Check current thread permissions to transition to the new state.
     ///
+    /// This function throws @ref MultiThreadingInvalidOperation if the calling
+    /// thread is one of the worker threads. This would prevent a dead-lock if
+    /// the calling thread would try to perform a thread pool state transition.
+    ///
     /// @param state The new transition state for the pool.
     /// @throw MultiThreadingInvalidOperation if the state transition is done on
-    /// any of the owned threads
+    /// any of the worker threads.
     void checkPermissions(State state);
 
     /// @brief Check specified thread id against own threads.
@@ -144,7 +154,7 @@ private:
     ///
     /// @param state The new transition state for the pool.
     /// @throw MultiThreadingInvalidOperation if the state transition is done on
-    /// any of the owned threads.
+    /// any of the worker threads.
     void setState(State state);
 
     /// @brief Thread-safe fetch of the pool's operational state.
index da1dc8c4aebd548ee4481972f4ebc2c78be20e16..0d8944abcf0acad67d6ce44ddb07c0b65ba14286 100644 (file)
@@ -271,7 +271,7 @@ public:
         return (request);
     }
 
-    /// @brief Test that owned threads are not permitted to change thread pool
+    /// @brief Test that worker threads are not permitted to change thread pool
     /// state.
     void testIllegalThreadPoolActions() {
         ASSERT_THROW(client_->start(), MultiThreadingInvalidOperation);
index b23617b62b9e5e30c2cb6dcc9c6f16390ef05dba..c6689667ccb78d9514ce4382236e28e526814664 100644 (file)
@@ -44,7 +44,6 @@ MultiThreadingMgr::enterCriticalSection() {
 
 void
 MultiThreadingMgr::exitCriticalSection() {
-    checkCallbacksPermissions();
     std::lock_guard<std::mutex> lk(mutex_);
     if (critical_section_count_ == 0) {
         isc_throw(InvalidOperation, "invalid negative value for override");
@@ -132,7 +131,7 @@ MultiThreadingMgr::apply(bool enabled, uint32_t thread_count, uint32_t queue_siz
 void
 MultiThreadingMgr::checkCallbacksPermissions() {
     if (getMode()) {
-        for (const auto& cb : cs_callbacks_.getCallbackPairs()) {
+        for (const auto& cb : cs_callbacks_.getCallbackSets()) {
             try {
                 (cb.check_cb_)();
             } catch (const isc::MultiThreadingInvalidOperation& ex) {
@@ -155,7 +154,7 @@ MultiThreadingMgr::checkCallbacksPermissions() {
 void
 MultiThreadingMgr::callEntryCallbacks() {
     if (getMode()) {
-        const auto& callbacks = cs_callbacks_.getCallbackPairs();
+        const auto& callbacks = cs_callbacks_.getCallbackSets();
         for (auto cb_it = callbacks.begin(); cb_it != callbacks.end(); cb_it++) {
             try {
                 (cb_it->entry_cb_)();
@@ -171,7 +170,7 @@ MultiThreadingMgr::callEntryCallbacks() {
 void
 MultiThreadingMgr::callExitCallbacks() {
     if (getMode()) {
-        const auto& callbacks = cs_callbacks_.getCallbackPairs();
+        const auto& callbacks = cs_callbacks_.getCallbackSets();
         for (auto cb_it = callbacks.rbegin(); cb_it != callbacks.rend(); cb_it++) {
             try {
                 (cb_it->exit_cb_)();
@@ -209,15 +208,15 @@ MultiThreadingMgr::startProcessing() {
 
 void
 MultiThreadingMgr::addCriticalSectionCallbacks(const std::string& name,
-                                               const CSCallbackPair::Callback& check_cb,
-                                               const CSCallbackPair::Callback& entry_cb,
-                                               const CSCallbackPair::Callback& exit_cb) {
-    cs_callbacks_.addCallbackPair(name, check_cb, entry_cb, exit_cb);
+                                               const CSCallbackSet::Callback& check_cb,
+                                               const CSCallbackSet::Callback& entry_cb,
+                                               const CSCallbackSet::Callback& exit_cb) {
+    cs_callbacks_.addCallbackSet(name, check_cb, entry_cb, exit_cb);
 }
 
 void
 MultiThreadingMgr::removeCriticalSectionCallbacks(const std::string& name) {
-    cs_callbacks_.removeCallbackPair(name);
+    cs_callbacks_.removeCallbackSet(name);
 }
 
 void
@@ -234,57 +233,57 @@ MultiThreadingCriticalSection::~MultiThreadingCriticalSection() {
 }
 
 void
-CSCallbackPairList::addCallbackPair(const std::string& name,
-                                    const CSCallbackPair::Callback& check_cb,
-                                    const CSCallbackPair::Callback& entry_cb,
-                                    const CSCallbackPair::Callback& exit_cb) {
+CSCallbackSetList::addCallbackSet(const std::string& name,
+                                  const CSCallbackSet::Callback& check_cb,
+                                  const CSCallbackSet::Callback& entry_cb,
+                                  const CSCallbackSet::Callback& exit_cb) {
     if (name.empty()) {
-        isc_throw(BadValue, "CSCallbackPairList - name cannot be empty");
+        isc_throw(BadValue, "CSCallbackSetList - name cannot be empty");
     }
 
     if (!check_cb) {
-        isc_throw(BadValue, "CSCallbackPairList - check callback for " << name
+        isc_throw(BadValue, "CSCallbackSetList - check callback for " << name
                   << " cannot be empty");
     }
 
     if (!entry_cb) {
-        isc_throw(BadValue, "CSCallbackPairList - entry callback for " << name
+        isc_throw(BadValue, "CSCallbackSetList - entry callback for " << name
                   << " cannot be empty");
     }
 
     if (!exit_cb) {
-        isc_throw(BadValue, "CSCallbackPairList - exit callback for " << name
+        isc_throw(BadValue, "CSCallbackSetList - exit callback for " << name
                   << " cannot be empty");
     }
 
-    for (auto const& callback : cb_pairs_) {
+    for (auto const& callback : cb_sets_) {
         if (callback.name_ == name) {
-            isc_throw(BadValue, "CSCallbackPairList - callbacks for " << name
+            isc_throw(BadValue, "CSCallbackSetList - callbacks for " << name
                       << " already exist");
         }
     }
 
-    cb_pairs_.push_back(CSCallbackPair(name, check_cb, entry_cb, exit_cb));
+    cb_sets_.push_back(CSCallbackSet(name, check_cb, entry_cb, exit_cb));
 }
 
 void
-CSCallbackPairList::removeCallbackPair(const std::string& name) {
-    for (auto it = cb_pairs_.begin(); it != cb_pairs_.end(); ++it) {
+CSCallbackSetList::removeCallbackSet(const std::string& name) {
+    for (auto it = cb_sets_.begin(); it != cb_sets_.end(); ++it) {
         if ((*it).name_ == name) {
-            cb_pairs_.erase(it);
+            cb_sets_.erase(it);
             break;
         }
     }
 }
 
 void
-CSCallbackPairList::removeAll() {
-    cb_pairs_.clear();
+CSCallbackSetList::removeAll() {
+    cb_sets_.clear();
 }
 
-const std::list<CSCallbackPair>&
-CSCallbackPairList::getCallbackPairs() {
-    return (cb_pairs_);
+const std::list<CSCallbackSet>&
+CSCallbackSetList::getCallbackSets() {
+    return (cb_sets_);
 }
 
 }  // namespace util
index 1a048b42fc0f0e892735534234d1fee6527cb34a..8108b7d9a078e0b06fa69840ec7de28f4bc221f1 100644 (file)
@@ -19,15 +19,21 @@ namespace isc {
 namespace util {
 
 
-/// @brief Embodies a named pair of CriticalSection callbacks.
+/// @brief Embodies a named set of CriticalSection callbacks.
 ///
-/// This class associates with a name, a pair of callbacks, one to be invoked
-/// before CriticalSection entry and exit callbacks to validate current thread
+/// This class associates with a name, a set of callbacks, one to be invoked
+/// before CriticalSection entry and exit callbacks to check current thread
 /// permissions to perform such actions, one to be invoked upon CriticalSection
-/// entry and one to be invoked upon CriticalSection exit,
-/// The name allows the pair to be uniquely identified such that they can be
+/// entry and one to be invoked upon CriticalSection exit.
+/// The name allows the set to be uniquely identified such that they can be
 /// added and removed as needed.
-struct CSCallbackPair {
+/// The check current thread permissions callback needs to throw
+/// @ref MultiThreadingInvalidOperation if the thread is not allowed to perform
+/// CriticalSection entry and exit. Any other exception thrown by the check
+/// permission callbacks will be silently ignored.
+/// The CriticalSection entry and exit callbacks exceptions will be silently
+/// ignored.
+struct CSCallbackSet {
     /// @brief Defines a callback as a simple void() functor.
     typedef std::function<void()> Callback;
 
@@ -38,8 +44,8 @@ struct CSCallbackPair {
     /// the CriticalSection entry and exit callbacks.
     /// @param entry_cb Callback to invoke upon CriticalSection entry.
     /// @param exit_cb Callback to invoke upon CriticalSection exit.
-    CSCallbackPair(const std::string& name, const Callback& check_cb,
-                   const Callback& entry_cb, const Callback& exit_cb)
+    CSCallbackSet(const std::string& name, const Callback& check_cb,
+                  const Callback& entry_cb, const Callback& exit_cb)
         : name_(name), check_cb_(check_cb), entry_cb_(entry_cb),
           exit_cb_(exit_cb) {}
 
@@ -56,18 +62,18 @@ struct CSCallbackPair {
     Callback exit_cb_;
 };
 
-/// @brief Maintains list of unique CSCallbackPairs.
+/// @brief Maintains list of unique CSCallbackSets.
 ///
 /// The list emphasizes iteration order and speed over
 /// retrieval by name. When iterating over the list of
-/// callback pairs, they are returned in the order they were
+/// callback sets, they are returned in the order they were
 /// added, not by name.
-class CSCallbackPairList {
+class CSCallbackSetList {
 public:
     /// @brief Constructor.
-    CSCallbackPairList() {}
+    CSCallbackSetList() {}
 
-    /// @brief Adds a callback pair to the list.
+    /// @brief Adds a callback set to the list.
     ///
     /// @param name Name of the callback to add.
     /// @param check_cb The check permissions callback to add.
@@ -76,26 +82,26 @@ public:
     ///
     /// @throw BadValue if the name is already in the list,
     /// the name is blank, or either callback is empty.
-    void addCallbackPair(const std::string& name,
-                         const CSCallbackPair::Callback& check_cb,
-                         const CSCallbackPair::Callback& entry_cb,
-                         const CSCallbackPair::Callback& exit_cb);
+    void addCallbackSet(const std::string& name,
+                        const CSCallbackSet::Callback& check_cb,
+                        const CSCallbackSet::Callback& entry_cb,
+                        const CSCallbackSet::Callback& exit_cb);
 
-    /// @brief Removes a callback pair from the list.
+    /// @brief Removes a callback set from the list.
     ///
     /// @param name Name of the callback to remove.
     /// If no such callback exists, it simply returns.
-    void removeCallbackPair(const std::string& name);
+    void removeCallbackSet(const std::string& name);
 
     /// @brief Removes all callbacks from the list.
     void removeAll();
 
-    /// @brief Fetches the list of callback pairs.
-    const std::list<CSCallbackPair>& getCallbackPairs();
+    /// @brief Fetches the list of callback sets.
+    const std::list<CSCallbackSet>& getCallbackSets();
 
 private:
-    /// @brief The list of callback pairs.
-    std::list<CSCallbackPair> cb_pairs_;
+    /// @brief The list of callback sets.
+    std::list<CSCallbackSet> cb_sets_;
 };
 
 /// @brief Multi Threading Manager.
@@ -214,7 +220,7 @@ public:
     /// configured, 0 for unlimited size
     void apply(bool enabled, uint32_t thread_count, uint32_t queue_size);
 
-    /// @brief Adds a pair of callbacks to the list of CriticalSection callbacks.
+    /// @brief Adds a set of callbacks to the list of CriticalSection callbacks.
     ///
     /// @note Callbacks must be exception-safe, handling any errors themselves.
     ///
@@ -227,9 +233,9 @@ public:
     /// @param exit_cb Callback to invoke upon CriticalSection exit. Cannot be
     /// empty.
     void addCriticalSectionCallbacks(const std::string& name,
-                                     const CSCallbackPair::Callback& check_cb,
-                                     const CSCallbackPair::Callback& entry_cb,
-                                     const CSCallbackPair::Callback& exit_cb);
+                                     const CSCallbackSet::Callback& check_cb,
+                                     const CSCallbackSet::Callback& entry_cb,
+                                     const CSCallbackSet::Callback& exit_cb);
 
     /// @brief Removes the set of callbacks associated with a given name
     /// from the list of CriticalSection callbacks.
@@ -266,9 +272,10 @@ private:
     ///
     /// Has no effect in single-threaded mode.
     ///
-    /// @note This function swallows exceptions thrown by validate
-    /// callbacks without logging to avoid breaking the CS
-    /// chain.
+    /// @note This function swallows exceptions thrown by all check permissions
+    /// callbacks without logging to avoid breaking the CS chain, except for the
+    /// @ref MultiThreadingInvalidOperation which needs to be propagated to the
+    /// scope of the @ref MultiThreadingCriticalSection constructor.
     /// @throw MultiThreadingInvalidOperation if current thread has no
     /// permission to enter CriticalSection.
     void checkCallbacksPermissions();
@@ -277,46 +284,41 @@ private:
     ///
     /// Has no effect in single-threaded mode.
     ///
-    /// @note This function swallows exceptions thrown by validate
-    /// callbacks without logging to avoid breaking the CS
-    /// chain.
+    /// @note This function swallows exceptions thrown by all entry callbacks
+    /// without logging to avoid breaking the CS chain.
     void callEntryCallbacks();
 
     /// @brief Class method which invokes CriticalSection entry callbacks.
     ///
     /// Has no effect in single-threaded mode.
     ///
-    /// @note This function swallows exceptions thrown by validate
-    /// callbacks without logging to avoid breaking the CS
-    /// chain.
+    /// @note This function swallows exceptions thrown by all exit callbacks
+    /// without logging to avoid breaking the CS chain.
     void callExitCallbacks();
 
     /// @brief Class method stops non-critical processing.
     ///
-    /// Stops the DHCP thread pool if it's running and invokes
-    /// all CriticalSection entry callbacks.  Has no effect
-    /// in single-threaded mode.
+    /// Stops the DHCP thread pool if it's running and invokes all
+    /// CriticalSection entry callbacks. Has no effect in single-threaded mode.
     ///
-    /// @note This function swallows exceptions thrown by exit
-    /// callbacks without logging to avoid breaking the CS
-    /// chain.
+    /// @note This function swallows exceptions thrown by all exit callbacks
+    /// without logging to avoid breaking the CS chain.
     void stopProcessing();
 
     /// @brief Class method (re)starts non-critical processing.
     ///
-    /// Starts the DHCP thread pool according to current configuration,
-    /// and invokes all CriticalSection exit callbacks. Has no effect
-    /// in single-threaded mode.
+    /// Starts the DHCP thread pool according to current configuration, and
+    /// invokes all CriticalSection exit callbacks. Has no effect in
+    /// single-threaded mode.
     ///
-    /// @note This function swallows exceptions thrown by entry
-    /// callbacks without logging to avoid breaking the CS
-    /// chain.
+    /// @note This function swallows exceptions thrown by all entry callbacks
+    /// without logging to avoid breaking the CS chain.
     void startProcessing();
 
     /// @brief The current multi-threading mode.
     ///
     /// The multi-threading flag: true if multi-threading is enabled, false
-    /// otherwise
+    /// otherwise.
     bool enabled_;
 
     /// @brief The critical section count.
@@ -333,8 +335,8 @@ private:
     /// @brief Packet processing thread pool.
     ThreadPool<std::function<void()>> thread_pool_;
 
-    /// @brief List of CriticalSection entry and exit callback pairs.
-    CSCallbackPairList cs_callbacks_;
+    /// @brief List of CriticalSection entry and exit callback sets.
+    CSCallbackSetList cs_callbacks_;
 
     /// @brief Mutex to protect the internal state.
     std::mutex mutex_;
index ae0fa83e11367c803bbed9eb98f96c562f3fcfd5..2dc20759ca0e67810a3f697acf5174b862a52686 100644 (file)
@@ -475,26 +475,26 @@ TEST_F(CriticalSectionCallbackTest, addAndRemove) {
 
     // Cannot add with a blank name.
     ASSERT_THROW_MSG(mgr.addCriticalSectionCallbacks("", [](){}, [](){}, [](){}),
-                     BadValue, "CSCallbackPairList - name cannot be empty");
+                     BadValue, "CSCallbackSetList - name cannot be empty");
 
     // Cannot add with an empty check callback.
     ASSERT_THROW_MSG(mgr.addCriticalSectionCallbacks("bad", nullptr, [](){}, [](){}),
-                     BadValue, "CSCallbackPairList - check callback for bad cannot be empty");
+                     BadValue, "CSCallbackSetList - check callback for bad cannot be empty");
 
     // Cannot add with an empty exit callback.
     ASSERT_THROW_MSG(mgr.addCriticalSectionCallbacks("bad", [](){}, nullptr, [](){}),
-                     BadValue, "CSCallbackPairList - entry callback for bad cannot be empty");
+                     BadValue, "CSCallbackSetList - entry callback for bad cannot be empty");
 
     // Cannot add with an empty exit callback.
     ASSERT_THROW_MSG(mgr.addCriticalSectionCallbacks("bad", [](){}, [](){}, nullptr),
-                     BadValue, "CSCallbackPairList - exit callback for bad cannot be empty");
+                     BadValue, "CSCallbackSetList - exit callback for bad cannot be empty");
 
     // Should be able to add foo.
     ASSERT_NO_THROW_LOG(mgr.addCriticalSectionCallbacks("foo", [](){}, [](){}, [](){}));
 
     // Should not be able to add foo twice.
     ASSERT_THROW_MSG(mgr.addCriticalSectionCallbacks("foo", [](){}, [](){}, [](){}),
-                     BadValue, "CSCallbackPairList - callbacks for foo already exist");
+                     BadValue, "CSCallbackSetList - callbacks for foo already exist");
 
     // Should be able to add bar.
     ASSERT_NO_THROW_LOG(mgr.addCriticalSectionCallbacks("bar", [](){}, [](){}, [](){}));
index 0136a957926732a1629b2d285aee4b6960313c06..6416d6b23370ab1196c073e3c02273920cf3d35c 100644 (file)
@@ -120,7 +120,7 @@ struct ThreadPool {
     void wait() {
         auto id = std::this_thread::get_id();
         if (checkThreadId(id)) {
-            isc_throw(MultiThreadingInvalidOperation, "thread pool stop called by owned thread");
+            isc_throw(MultiThreadingInvalidOperation, "thread pool stop called by worker thread");
         }
         queue_.wait();
     }
@@ -135,7 +135,7 @@ struct ThreadPool {
     bool wait(uint32_t seconds) {
         auto id = std::this_thread::get_id();
         if (checkThreadId(id)) {
-            isc_throw(MultiThreadingInvalidOperation, "thread pool stop called by owned thread");
+            isc_throw(MultiThreadingInvalidOperation, "thread pool stop called by worker thread");
         }
         return (queue_.wait(seconds));
     }
@@ -203,7 +203,7 @@ private:
     void stopInternal() {
         auto id = std::this_thread::get_id();
         if (checkThreadId(id)) {
-            isc_throw(MultiThreadingInvalidOperation, "thread pool stop called by owned thread");
+            isc_throw(MultiThreadingInvalidOperation, "thread pool stop called by worker thread");
         }
         queue_.disable();
         for (auto thread : threads_) {