Mrntt: Shut down mind threads before printing usage & exiting
This commit is contained in:
@@ -27,7 +27,7 @@ void ComponentThread::marionetteMain(ComponentThread& self)
|
|||||||
std::cout << __func__ << ": Waiting for command line JOLT" << std::endl;
|
std::cout << __func__ << ": Waiting for command line JOLT" << std::endl;
|
||||||
self.getIoService().run();
|
self.getIoService().run();
|
||||||
self.initializeTls();
|
self.initializeTls();
|
||||||
mrntt::exitCode = 0;
|
mrntt::exitCode = EXIT_SUCCESS;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
OptionParser &options = OptionParser::getOptions();
|
OptionParser &options = OptionParser::getOptions();
|
||||||
@@ -48,14 +48,29 @@ void ComponentThread::marionetteMain(ComponentThread& self)
|
|||||||
std::cerr << __func__ << ": Exception occurred: " << e.what()
|
std::cerr << __func__ << ": Exception occurred: " << e.what()
|
||||||
<< '\n' << options.getUsage() << '\n';
|
<< '\n' << options.getUsage() << '\n';
|
||||||
|
|
||||||
mrntt::exitCode = EXIT_FAILURE;
|
options.printUsage = true;
|
||||||
return;
|
mrntt::exitCode = EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.printUsage)
|
if (options.printUsage)
|
||||||
{
|
{
|
||||||
std::cout << __func__ << ": " << options.getUsage() << std::endl;
|
self.getIoService().post([&options]()
|
||||||
mrntt::exitCode = EXIT_SUCCESS;
|
{
|
||||||
|
ComponentThread::joltAllMindThreadsReq(
|
||||||
|
[&options]()
|
||||||
|
{
|
||||||
|
ComponentThread::exitAllMindThreadsReq(
|
||||||
|
[&options]()
|
||||||
|
{
|
||||||
|
std::cout << __func__ << ": " << options.getUsage()
|
||||||
|
<< '\n';
|
||||||
|
mrntt::mrntt->getIoService().stop();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
self.getIoService().reset();
|
||||||
|
self.getIoService().run();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user