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;
|
||||
self.getIoService().run();
|
||||
self.initializeTls();
|
||||
mrntt::exitCode = 0;
|
||||
mrntt::exitCode = EXIT_SUCCESS;
|
||||
|
||||
try {
|
||||
OptionParser &options = OptionParser::getOptions();
|
||||
@@ -48,14 +48,29 @@ void ComponentThread::marionetteMain(ComponentThread& self)
|
||||
std::cerr << __func__ << ": Exception occurred: " << e.what()
|
||||
<< '\n' << options.getUsage() << '\n';
|
||||
|
||||
mrntt::exitCode = EXIT_FAILURE;
|
||||
return;
|
||||
options.printUsage = true;
|
||||
mrntt::exitCode = EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (options.printUsage)
|
||||
{
|
||||
std::cout << __func__ << ": " << options.getUsage() << std::endl;
|
||||
mrntt::exitCode = EXIT_SUCCESS;
|
||||
self.getIoService().post([&options]()
|
||||
{
|
||||
ComponentThread::joltAllMindThreadsReq(
|
||||
[&options]()
|
||||
{
|
||||
ComponentThread::exitAllMindThreadsReq(
|
||||
[&options]()
|
||||
{
|
||||
std::cout << __func__ << ": " << options.getUsage()
|
||||
<< '\n';
|
||||
mrntt::mrntt->getIoService().stop();
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
self.getIoService().reset();
|
||||
self.getIoService().run();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user