2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +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.
/// @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
/// deadlock
/// deadlock.
/// This is mainly useful in hook commands which handle configuration
/// changes.
class MultiThreadingCriticalSection : public boost::noncopyable {
@@ -30,13 +30,13 @@ public:
/// @brief Constructor.
///
/// 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();
/// @brief Destructor.
///
/// Leaving the critical section. The packet thread pool instance will be
/// started according to new configuration.
/// started according to the new configuration.
virtual ~MultiThreadingCriticalSection();
private:

View File

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

View File

@@ -66,22 +66,23 @@ public:
/// @param enabled The new mode.
void setMode(bool enabled);
/// @brief Increment override
/// @brief Increment override.
///
/// When entering @ref MultiThreadingCriticalSection, increment override
/// 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();
/// @brief Decrement override
/// @brief 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();
/// @brief Get override
/// @brief Get override.
///
/// Get the override flag
/// Get the override flag.
bool getOverride();
/// @brief Get the packet thread pool.
@@ -106,7 +107,7 @@ public:
/// @return The thread count.
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,
/// false otherwise.
@@ -131,7 +132,7 @@ private:
///
/// In case the configuration is applied within a
/// @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.
uint32_t override_;