mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 13:37:55 +00:00
[#1016] implemented startPktProcessing and stopPktProcessing
This commit is contained in:
parent
d955b3dda2
commit
fc5ddfaab0
@ -18,16 +18,20 @@ namespace dhcp {
|
||||
|
||||
void
|
||||
MultiThreadingCriticalSection::stopPktProcessing() {
|
||||
isc_throw(NotImplemented,
|
||||
"MultiThreadingCriticalSection::stopPktProcessing "
|
||||
"is not yet implemented");
|
||||
auto& thread_pool = MultiThreadingMgr::instance().getPktThreadPool();
|
||||
auto size = MultiThreadingMgr::instance().getPktThreadPoolSize();
|
||||
if (size) {
|
||||
thread_pool.stop();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MultiThreadingCriticalSection::startPktProcessing() {
|
||||
isc_throw(NotImplemented,
|
||||
"MultiThreadingCriticalSection::startPktProcessing "
|
||||
"is not yet implemented");
|
||||
auto& thread_pool = MultiThreadingMgr::instance().getPktThreadPool();
|
||||
auto size = MultiThreadingMgr::instance().getPktThreadPoolSize();
|
||||
if (size) {
|
||||
thread_pool.start(size);
|
||||
}
|
||||
}
|
||||
|
||||
MultiThreadingCriticalSection::MultiThreadingCriticalSection() {
|
||||
|
@ -27,21 +27,29 @@ void startPktProcessing();
|
||||
///
|
||||
/// @note: the multi-threading mode MUST NOT be changed in the RAII
|
||||
/// @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
|
||||
/// dead-lock
|
||||
class MultiThreadingCriticalSection : public boost::noncopyable {
|
||||
public:
|
||||
|
||||
/// @brief Constructor.
|
||||
///
|
||||
/// Entering the critical section.
|
||||
MultiThreadingCriticalSection();
|
||||
|
||||
/// @brief Destructor.
|
||||
///
|
||||
/// Leaving the critical section.
|
||||
virtual ~MultiThreadingCriticalSection();
|
||||
|
||||
/// @brief Class method stopping and joining all threads of the pool.
|
||||
///
|
||||
/// @throw isc::NotImplemented until is implemented.
|
||||
static void stopPktProcessing();
|
||||
|
||||
/// @brief Class method (re)starting threads of the pool.
|
||||
///
|
||||
/// @throw isc::NotImplemented until is implemented.
|
||||
static void startPktProcessing();
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user