mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 22:15:23 +00:00
[#1599] addressed comments
This commit is contained in:
@@ -45,9 +45,7 @@ MultiThreadingMgr::enterCriticalSection() {
|
|||||||
++critical_section_count_;
|
++critical_section_count_;
|
||||||
if (getMode() && !inside) {
|
if (getMode() && !inside) {
|
||||||
if (getThreadPoolSize()) {
|
if (getThreadPoolSize()) {
|
||||||
// We simply pause without waiting for all tasks to complete.
|
// Simply pause after waiting for started tasks to complete.
|
||||||
// We could also call wait() and pause(false) so that all tasks are
|
|
||||||
// complete and threads are stopped.
|
|
||||||
thread_pool_.pause();
|
thread_pool_.pause();
|
||||||
}
|
}
|
||||||
// Now it is safe to call callbacks which can also create other CSs.
|
// Now it is safe to call callbacks which can also create other CSs.
|
||||||
|
@@ -156,20 +156,22 @@ struct ThreadPool {
|
|||||||
queue_.resume();
|
queue_.resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief return the state of the queue
|
/// @brief return the enable state of the queue
|
||||||
///
|
///
|
||||||
/// Returns the state of the queue
|
/// The 'enabled' state corresponds to true value
|
||||||
|
/// The 'disabled' state corresponds to false value
|
||||||
///
|
///
|
||||||
/// @return the state
|
/// @return the enable state of the queue
|
||||||
bool enabled() {
|
bool enabled() {
|
||||||
return (queue_.enabled());
|
return (queue_.enabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief return the state of the threads
|
/// @brief return the pause state of the queue
|
||||||
///
|
///
|
||||||
/// Returns the state of the threads
|
/// The 'paused' state corresponds to true value
|
||||||
|
/// The 'resumed' state corresponds to false value
|
||||||
///
|
///
|
||||||
/// @return the state
|
/// @return the pause state of the queue
|
||||||
bool paused() {
|
bool paused() {
|
||||||
return (queue_.paused());
|
return (queue_.paused());
|
||||||
}
|
}
|
||||||
@@ -366,6 +368,8 @@ private:
|
|||||||
/// If the queue is 'enabled', this function returns the first element in
|
/// If the queue is 'enabled', this function returns the first element in
|
||||||
/// the queue or blocks the calling thread if there are no work items
|
/// the queue or blocks the calling thread if there are no work items
|
||||||
/// available.
|
/// available.
|
||||||
|
/// If the queue is 'paused', this function blocks the calling thread until
|
||||||
|
/// the queue is 'resumed'.
|
||||||
/// Before a work item is returned statistics are updated.
|
/// Before a work item is returned statistics are updated.
|
||||||
///
|
///
|
||||||
/// @return the first work item from the queue or an empty element.
|
/// @return the first work item from the queue or an empty element.
|
||||||
@@ -505,20 +509,22 @@ private:
|
|||||||
cv_.notify_all();
|
cv_.notify_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief return the state of the queue
|
/// @brief return the enable state of the queue
|
||||||
///
|
///
|
||||||
/// Returns the state of the queue
|
/// The 'enabled' state corresponds to true value
|
||||||
|
/// The 'disabled' state corresponds to false value
|
||||||
///
|
///
|
||||||
/// @return the state
|
/// @return the enable state of the queue
|
||||||
bool enabled() {
|
bool enabled() {
|
||||||
return (enabled_);
|
return (enabled_);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief return the state of the threads
|
/// @brief return the pause state of the queue
|
||||||
///
|
///
|
||||||
/// Returns the state of the threads
|
/// The 'paused' state corresponds to true value
|
||||||
|
/// The 'resumed' state corresponds to false value
|
||||||
///
|
///
|
||||||
/// @return the state
|
/// @return the pause state of the queue
|
||||||
bool paused() {
|
bool paused() {
|
||||||
return (paused_);
|
return (paused_);
|
||||||
}
|
}
|
||||||
@@ -539,7 +545,7 @@ private:
|
|||||||
/// @brief condition variable used to wait for all threads to be paused
|
/// @brief condition variable used to wait for all threads to be paused
|
||||||
std::condition_variable wait_threads_cv_;
|
std::condition_variable wait_threads_cv_;
|
||||||
|
|
||||||
/// @brief the state of the queue
|
/// @brief the enable state of the queue
|
||||||
/// The 'enabled' state corresponds to true value
|
/// The 'enabled' state corresponds to true value
|
||||||
/// The 'disabled' state corresponds to false value
|
/// The 'disabled' state corresponds to false value
|
||||||
std::atomic<bool> enabled_;
|
std::atomic<bool> enabled_;
|
||||||
|
Reference in New Issue
Block a user