Skip to content

Commit

Permalink
Fix: for stop restart impl
Browse files Browse the repository at this point in the history
  • Loading branch information
Grabt234 committed Nov 12, 2024
1 parent 8139515 commit 18b4671
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions source/BaseModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ BaseModule::~BaseModule()

void BaseModule::ContinuouslyTryProcess()
{

while (!m_bShutDown)
{
std::shared_ptr<BaseChunk> pBaseChunk;
Expand Down Expand Up @@ -51,11 +52,24 @@ void BaseModule::StartProcessing()
std::string strWarning = std::string(__FUNCTION__) + ": Processing thread already started";
PLOG_WARNING << strWarning;
}

PLOG_WARNING << GetModuleType() +" Thread joined";

}

void BaseModule::StopProcessing()
{
m_bShutDown = true;

while (!m_thread.joinable())
{
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
PLOG_INFO << "Waiting for " + GetModuleType() + " thread to shut down";
}

// Now we close out the thread and prepare to restart it
m_thread.join();
m_bShutDown = false;
}

void BaseModule::SetNextModule(std::shared_ptr<BaseModule> pNextModule)
Expand Down

0 comments on commit 18b4671

Please sign in to comment.