Skip to content

Commit

Permalink
update pipeline.cpp to stop and terminate control module with pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
kushaljain-apra committed Sep 17, 2024
1 parent b9a5ea2 commit 42550e3
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions base/src/PipeLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ void PipeLine::stop()
i->get()->stop();
}
}

This comment has been minimized.

Copy link
@kumaakh

kumaakh Sep 18, 2024

Collaborator

Why are we assuming that control module is available with module[0] ? @kushaljain-apra ideally we should do this for all control modules... it is possible that some complex pipelines have more than 1 control modules

if ((modules[0]->controlModule) != nullptr)
{
modules[0]->controlModule->stop();
}
}

void PipeLine::wait_for_all(bool ignoreStatus)
Expand All @@ -242,15 +247,15 @@ void PipeLine::wait_for_all(bool ignoreStatus)
return;
}

for (auto i = modules.begin(); i != modules.end(); i++)
if ((modules[0]->controlModule) != nullptr)
{
Module& m = *(i->get());
Module& m = *(modules[0]->controlModule);
m.myThread.join();
}

if ((modules[0]->controlModule) != nullptr)
for (auto i = modules.begin(); i != modules.end(); i++)
{
Module& m = *(modules[0]->controlModule);
Module& m = *(i->get());
m.myThread.join();
}
}
Expand All @@ -264,12 +269,6 @@ void PipeLine::interrupt_wait_for_all()
return;
}

for (auto i = modules.begin(); i != modules.end(); i++)
{
Module& m = *(i->get());
m.myThread.interrupt();
}

if ((modules[0]->controlModule) != nullptr)
{
Module& m = *(modules[0]->controlModule);
Expand All @@ -279,7 +278,7 @@ void PipeLine::interrupt_wait_for_all()
for (auto i = modules.begin(); i != modules.end(); i++)
{
Module& m = *(i->get());
m.myThread.join();
m.myThread.interrupt();
}

if ((modules[0]->controlModule) != nullptr)
Expand All @@ -288,6 +287,12 @@ void PipeLine::interrupt_wait_for_all()
m.myThread.join();
}

for (auto i = modules.begin(); i != modules.end(); i++)
{
Module& m = *(i->get());
m.myThread.join();
}

myStatus = PL_STOPPED;
}

Expand Down

0 comments on commit 42550e3

Please sign in to comment.