2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

[#1016] implemented startPktProcessing and stopPktProcessing

This commit is contained in:
Razvan Becheriu
2020-02-21 18:51:06 +02:00
parent d955b3dda2
commit fc5ddfaab0
2 changed files with 18 additions and 6 deletions

View File

@@ -18,16 +18,20 @@ namespace dhcp {
void void
MultiThreadingCriticalSection::stopPktProcessing() { MultiThreadingCriticalSection::stopPktProcessing() {
isc_throw(NotImplemented, auto& thread_pool = MultiThreadingMgr::instance().getPktThreadPool();
"MultiThreadingCriticalSection::stopPktProcessing " auto size = MultiThreadingMgr::instance().getPktThreadPoolSize();
"is not yet implemented"); if (size) {
thread_pool.stop();
}
} }
void void
MultiThreadingCriticalSection::startPktProcessing() { MultiThreadingCriticalSection::startPktProcessing() {
isc_throw(NotImplemented, auto& thread_pool = MultiThreadingMgr::instance().getPktThreadPool();
"MultiThreadingCriticalSection::startPktProcessing " auto size = MultiThreadingMgr::instance().getPktThreadPoolSize();
"is not yet implemented"); if (size) {
thread_pool.start(size);
}
} }
MultiThreadingCriticalSection::MultiThreadingCriticalSection() { MultiThreadingCriticalSection::MultiThreadingCriticalSection() {

View File

@@ -27,21 +27,29 @@ void startPktProcessing();
/// ///
/// @note: the multi-threading mode MUST NOT be changed in the RAII /// @note: the multi-threading mode MUST NOT be changed in the RAII
/// @c MultiThreadingCriticalSection body. /// @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 { class MultiThreadingCriticalSection : public boost::noncopyable {
public: public:
/// @brief Constructor. /// @brief Constructor.
///
/// Entering the critical section. /// Entering the critical section.
MultiThreadingCriticalSection(); MultiThreadingCriticalSection();
/// @brief Destructor. /// @brief Destructor.
///
/// Leaving the critical section. /// Leaving the critical section.
virtual ~MultiThreadingCriticalSection(); virtual ~MultiThreadingCriticalSection();
/// @brief Class method stopping and joining all threads of the pool. /// @brief Class method stopping and joining all threads of the pool.
///
/// @throw isc::NotImplemented until is implemented. /// @throw isc::NotImplemented until is implemented.
static void stopPktProcessing(); static void stopPktProcessing();
/// @brief Class method (re)starting threads of the pool. /// @brief Class method (re)starting threads of the pool.
///
/// @throw isc::NotImplemented until is implemented. /// @throw isc::NotImplemented until is implemented.
static void startPktProcessing(); static void startPktProcessing();
}; };