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() {
///
/// @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();
};