Commit 00fd7bcd authored by Francis Dupont's avatar Francis Dupont

[970-implement-multi-threading-critical-section] Removed the enabled_ local copy of the MT mode

parent d54a54aa
......@@ -29,15 +29,14 @@ MultiThreadingCriticalSection::startPktProcessing() {
"is not yet implemented");
}
MultiThreadingCriticalSection::MultiThreadingCriticalSection()
: enabled_(MultiThreadingMgr::instance().getMode()) {
if (enabled_) {
MultiThreadingCriticalSection::MultiThreadingCriticalSection() {
if (MultiThreadingMgr::instance().getMode()) {
stopPktProcessing();
}
}
MultiThreadingCriticalSection::~MultiThreadingCriticalSection() {
if (enabled_) {
if (MultiThreadingMgr::instance().getMode()) {
startPktProcessing();
}
}
......
......@@ -12,7 +12,7 @@
namespace isc {
namespace dhcp {
/// @note: everything here MUST be used only from the main thread.
/// @note: everything here MUST be used ONLY from the main thread.
/// When called from a thread of the pool it can deadlock.
/// @brief Function stopping and joining all threads of the pool.
......@@ -24,6 +24,9 @@ void stopPktProcessing();
void startPktProcessing();
/// @brief RAII class creating a critical section.
///
/// @note: the multi-threading mode MUST NOT be changed in the RAII
/// @c MultiThreadingCriticalSection body.
class MultiThreadingCriticalSection : public boost::noncopyable {
public:
/// @brief Constructor.
......@@ -41,10 +44,6 @@ public:
/// @brief Class method (re)starting threads of the pool.
/// @throw isc::NotImplemented until is implemented.
static void startPktProcessing();
private:
/// @brief Local copy of the multi-threading mode.
bool enabled_;
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment