2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-01 06:25:34 +00:00

[#1016] minor changes

This commit is contained in:
Razvan Becheriu
2020-02-27 15:11:16 +02:00
parent f1747e65aa
commit ab48ca8bb7
3 changed files with 13 additions and 14 deletions

View File

@@ -21,7 +21,7 @@ namespace dhcp {
/// @c MultiThreadingCriticalSection body. /// @c MultiThreadingCriticalSection body.
/// @note: starting and stopping the packet thread pool should be handled /// @note: starting and stopping the packet thread pool should be handled
/// in the main thread, if done on one of the processing threads will cause a /// in the main thread, if done on one of the processing threads will cause a
/// deadlock /// deadlock.
/// This is mainly useful in hook commands which handle configuration /// This is mainly useful in hook commands which handle configuration
/// changes. /// changes.
class MultiThreadingCriticalSection : public boost::noncopyable { class MultiThreadingCriticalSection : public boost::noncopyable {
@@ -30,13 +30,13 @@ public:
/// @brief Constructor. /// @brief Constructor.
/// ///
/// Entering the critical section. The packet thread pool instance will be /// Entering the critical section. The packet thread pool instance will be
/// stopped so that configuration changes can be safely applied. /// stopped so that all configuration changes can be safely applied.
MultiThreadingCriticalSection(); MultiThreadingCriticalSection();
/// @brief Destructor. /// @brief Destructor.
/// ///
/// Leaving the critical section. The packet thread pool instance will be /// Leaving the critical section. The packet thread pool instance will be
/// started according to new configuration. /// started according to the new configuration.
virtual ~MultiThreadingCriticalSection(); virtual ~MultiThreadingCriticalSection();
private: private:

View File

@@ -90,9 +90,7 @@ TEST(MultiThreadingUtil, constructorAndDestructor) {
// thread count should match // thread count should match
EXPECT_EQ(thread_pool.size(), 64); EXPECT_EQ(thread_pool.size(), 64);
// apply multi-threading configuration with 0 threads // apply multi-threading configuration with 0 threads
MultiThreadingMgr::instance().apply(false, 64); MultiThreadingMgr::instance().apply(false, 0);
// thread pool should be stopped
EXPECT_EQ(thread_pool.size(), 0);
} }
} // namespace } // namespace

View File

@@ -66,22 +66,23 @@ public:
/// @param enabled The new mode. /// @param enabled The new mode.
void setMode(bool enabled); void setMode(bool enabled);
/// @brief Increment override /// @brief Increment override.
/// ///
/// When entering @ref MultiThreadingCriticalSection, increment override /// When entering @ref MultiThreadingCriticalSection, increment override
/// so that any configuration change that might start the packet thread pool /// so that any configuration change that might start the packet thread pool
/// is delayed until exiting the respective section /// is delayed until exiting the respective section.
void incrementOverride(); void incrementOverride();
/// @brief Decrement override /// @brief Decrement override.
/// ///
/// When exiting @ref MultiThreadingCriticalSection, decrement override /// When exiting @ref MultiThreadingCriticalSection, decrement override
/// so that the packet thread pool can be started according to configuration /// so that the packet thread pool can be started according to the new
/// configuration.
void decrementOverride(); void decrementOverride();
/// @brief Get override /// @brief Get override.
/// ///
/// Get the override flag /// Get the override flag.
bool getOverride(); bool getOverride();
/// @brief Get the packet thread pool. /// @brief Get the packet thread pool.
@@ -106,7 +107,7 @@ public:
/// @return The thread count. /// @return The thread count.
static uint32_t supportedThreadCount(); static uint32_t supportedThreadCount();
/// @brief Apply the multi-threading related settings /// @brief Apply the multi-threading related settings.
/// ///
/// @param enabled The enabled flag: true if multi-threading is enabled, /// @param enabled The enabled flag: true if multi-threading is enabled,
/// false otherwise. /// false otherwise.
@@ -131,7 +132,7 @@ private:
/// ///
/// In case the configuration is applied within a /// In case the configuration is applied within a
/// @ref MultiThreadingCriticalSection, the thread pool should not be /// @ref MultiThreadingCriticalSection, the thread pool should not be
/// started until the section is over. /// started until leaving the respective section.
/// This also handles multiple interleaved sections. /// This also handles multiple interleaved sections.
uint32_t override_; uint32_t override_;