Split: Split libspinscale off from SMO.
Now we can probably begin using libspinscale in Couresilient without worrying about excessive technical debt later on.
This commit is contained in:
@@ -30,61 +30,4 @@ std::string ComponentThread::getThreadName(sscl::ThreadId id)
|
||||
return threadNames[static_cast<int>(smoId)];
|
||||
}
|
||||
|
||||
void sscl::PuppetThread::main(sscl::PuppetThread& self)
|
||||
{
|
||||
std::string threadName = "smo:" + self.name;
|
||||
pthread_setname_np(pthread_self(), threadName.c_str());
|
||||
|
||||
self.getIoService().run();
|
||||
self.initializeTls();
|
||||
|
||||
std::cout << self.name << ":" << __func__ << ": Entering event loop" <<"\n";
|
||||
|
||||
/* We loop here because when an exception is caught, we need to first catch
|
||||
* it in the catch blocks. We bubble the exception to mrntt in the catch
|
||||
* blocks, and then we loop here to await control messages from mrntt.
|
||||
*
|
||||
* We can't just exit on our own. Rather, we must wait for mrntt to tell us
|
||||
* to exit. When we wish to finally exit, we set keepLooping to false.
|
||||
*/
|
||||
for (self.keepLooping = true; self.keepLooping;)
|
||||
{
|
||||
bool sendExceptionInd = false;
|
||||
|
||||
try {
|
||||
/** EXPLANATION:
|
||||
* This reset() call is crucial for async bridging patterns
|
||||
* to work.
|
||||
* When the outermost thread's io_service is stop()ped (e.g.,
|
||||
* from JOLT sequence), it won't process any new work until
|
||||
* reset() is called, even if nested async operations try to
|
||||
* post work to it. This means async bridges invoked from
|
||||
* the outermost thread main sequence won't work until this
|
||||
* reset() call.
|
||||
*/
|
||||
self.getIoService().reset();
|
||||
self.getIoService().run();
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
sendExceptionInd = true;
|
||||
std::cerr << self.name << ":" << __func__
|
||||
<< ": Exception occurred: " << e.what() << "\n";
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
sendExceptionInd = true;
|
||||
std::cerr << self.name << ":" << __func__
|
||||
<< ": Unknown exception occurred" << "\n";
|
||||
}
|
||||
|
||||
if (sendExceptionInd)
|
||||
{
|
||||
self.handleException();
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << self.name << ":" << __func__ << ": Exited event loop" << "\n";
|
||||
}
|
||||
|
||||
} // namespace sscl
|
||||
|
||||
Reference in New Issue
Block a user