Update: rename mrntt=>pptr
This commit is contained in:
+1
-1
Submodule libspinscale updated: e77ecd447d...e813962168
@@ -6,26 +6,26 @@
|
||||
|
||||
int main(int argc, char *argv[], char *envp[])
|
||||
{
|
||||
// Set the marionette thread ID before using any ComponentThread functionality
|
||||
sscl::mrntt::setMarionetteThreadId(smo::SmoThreadId::MRNTT);
|
||||
// Set the pptr thread ID before using any ComponentThread functionality
|
||||
sscl::pptr::setPuppeteerThreadId(smo::SmoThreadId::MRNTT);
|
||||
pthread_setname_np(pthread_self(), "smo:CRT:main");
|
||||
/* We don't do anything inside of main()
|
||||
* Main merely waits for the marionette thread to exit.
|
||||
*/
|
||||
std::cout << "CRT:" << __func__ << ": about to JOLT Mrntt with cmdline args"
|
||||
<< '\n';
|
||||
sscl::mrntt::thread->getIoService().post(
|
||||
sscl::pptr::thread->getIoService().post(
|
||||
[argc, argv, envp]()
|
||||
{
|
||||
std::cout << "Mrntt:" << __func__ << ":JOLTED: setting cmdline args"
|
||||
<< '\n';
|
||||
sscl::CrtCommandLineArgs::set(argc, argv, envp);
|
||||
sscl::mrntt::thread->getIoService().stop();
|
||||
sscl::pptr::thread->getIoService().stop();
|
||||
}
|
||||
);
|
||||
|
||||
sscl::mrntt::thread->thread.join();
|
||||
sscl::pptr::thread->thread.join();
|
||||
std::cout << "CRT:" << __func__ << ": Mrntt exited with code '"
|
||||
<< sscl::mrntt::exitCode << "'\n";
|
||||
return sscl::mrntt::exitCode;
|
||||
<< sscl::pptr::exitCode << "'\n";
|
||||
return sscl::pptr::exitCode;
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ void DeviceManager::newDeviceAttachmentSpecInd(
|
||||
});
|
||||
|
||||
NewDeviceAttachmentSpecInd::LockerAndInvoker lockvoker(
|
||||
*request, sscl::mrntt::mrntt.thread,
|
||||
*request, sscl::pptr::mrntt.thread,
|
||||
std::bind(
|
||||
&NewDeviceAttachmentSpecInd::newDeviceAttachmentSpecInd1_posted,
|
||||
request.get(), request));
|
||||
@@ -323,7 +323,7 @@ void DeviceManager::removeDeviceAttachmentSpecReq(
|
||||
});
|
||||
|
||||
RemoveDeviceAttachmentSpecReq::LockerAndInvoker lockvoker(
|
||||
*request, sscl::mrntt::mrntt.thread,
|
||||
*request, sscl::pptr::mrntt.thread,
|
||||
std::bind(
|
||||
&RemoveDeviceAttachmentSpecReq
|
||||
::removeDeviceAttachmentSpecReq1_posted,
|
||||
@@ -500,7 +500,7 @@ void DeviceManager::attachStimBuffDeviceReq(
|
||||
});
|
||||
|
||||
AttachStimBuffDeviceReq::LockerAndInvoker lockvoker(
|
||||
*request, sscl::mrntt::mrntt.thread,
|
||||
*request, sscl::pptr::mrntt.thread,
|
||||
std::bind(
|
||||
&AttachStimBuffDeviceReq::attachStimBuffDeviceReq1_posted,
|
||||
request.get(), request));
|
||||
@@ -535,7 +535,7 @@ void DeviceManager::detachStimBuffDeviceReq(
|
||||
});
|
||||
|
||||
DetachStimBuffDeviceReq::LockerAndInvoker lockvoker(
|
||||
*request, sscl::mrntt::mrntt.thread,
|
||||
*request, sscl::pptr::mrntt.thread,
|
||||
std::bind(
|
||||
&DetachStimBuffDeviceReq::detachStimBuffDeviceReq1_posted,
|
||||
request.get(), request));
|
||||
@@ -626,7 +626,7 @@ void DeviceManager::attachAllUnattachedDevicesFromReq(
|
||||
auto request = std::make_shared<AttachAllUnattachedDevicesFromReq>(
|
||||
specs->size(), specs, caller, std::move(cb));
|
||||
|
||||
sscl::mrntt::mrntt.thread->getIoService().post(
|
||||
sscl::pptr::mrntt.thread->getIoService().post(
|
||||
STC(std::bind(
|
||||
&AttachAllUnattachedDevicesFromReq
|
||||
::attachAllUnattachedDevicesFromReq1_posted,
|
||||
@@ -723,7 +723,7 @@ void DeviceManager::attachAllUnattachedDevicesFromKnownListReq(
|
||||
});
|
||||
|
||||
AttachAllUnattachedDevicesFromKnownListReq::LockerAndInvoker lockvoker(
|
||||
*request, sscl::mrntt::mrntt.thread,
|
||||
*request, sscl::pptr::mrntt.thread,
|
||||
std::bind(
|
||||
&AttachAllUnattachedDevicesFromKnownListReq
|
||||
::attachAllUnattachedDevicesFromKnownListReq1_posted,
|
||||
@@ -807,7 +807,7 @@ void DeviceManager::detachAllAttachedDeviceRoles(
|
||||
DeviceManager::getInstance().attachedDeviceRoles.size(),
|
||||
caller, std::move(cb));
|
||||
|
||||
sscl::mrntt::mrntt.thread->getIoService().post(
|
||||
sscl::pptr::mrntt.thread->getIoService().post(
|
||||
STC(std::bind(
|
||||
&DetachAllAttachedDeviceRoles::detachAllAttachedDeviceRoles1_posted,
|
||||
request.get(), request)));
|
||||
@@ -816,7 +816,7 @@ void DeviceManager::detachAllAttachedDeviceRoles(
|
||||
void DeviceManager::initializeDeviceReattacher()
|
||||
{
|
||||
deviceReattacher = std::make_unique<DeviceReattacher>(
|
||||
*this, sscl::mrntt::mrntt.thread);
|
||||
*this, sscl::pptr::mrntt.thread);
|
||||
|
||||
deviceReattacher->start();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <mindManager/mindManager.h>
|
||||
|
||||
namespace sscl {
|
||||
namespace mrntt {
|
||||
namespace pptr {
|
||||
|
||||
class MarionetteComponent::MrnttLifetimeMgmtOp
|
||||
: public sscl::PostedAsynchronousContinuation<mrnttLifetimeMgmtOpCbFn>
|
||||
@@ -139,13 +139,13 @@ public:
|
||||
+ ": Must be executed on Marionette thread");
|
||||
}
|
||||
|
||||
sscl::mrntt::mrntt.finalizeReq({nullptr, std::bind(
|
||||
&sscl::mrntt::marionetteFinalizeReqCb,
|
||||
sscl::pptr::mrntt.finalizeReq({nullptr, std::bind(
|
||||
&sscl::pptr::marionetteFinalizeReqCb,
|
||||
std::placeholders::_1)});
|
||||
}
|
||||
};
|
||||
|
||||
void sscl::mrntt::MarionetteComponent::initializeReq(
|
||||
void sscl::pptr::MarionetteComponent::initializeReq(
|
||||
sscl::Callback<mrnttLifetimeMgmtOpCbFn> callback)
|
||||
{
|
||||
auto mrntt = sscl::ComponentThread::getSelf();
|
||||
@@ -165,7 +165,7 @@ void sscl::mrntt::MarionetteComponent::initializeReq(
|
||||
request.get(), request)));
|
||||
}
|
||||
|
||||
void sscl::mrntt::MarionetteComponent::finalizeReq(
|
||||
void sscl::pptr::MarionetteComponent::finalizeReq(
|
||||
sscl::Callback<mrnttLifetimeMgmtOpCbFn> callback)
|
||||
{
|
||||
auto mrntt = sscl::ComponentThread::getSelf();
|
||||
@@ -185,7 +185,7 @@ void sscl::mrntt::MarionetteComponent::finalizeReq(
|
||||
request.get(), request)));
|
||||
}
|
||||
|
||||
void sscl::mrntt::MarionetteComponent::exceptionInd()
|
||||
void sscl::pptr::MarionetteComponent::exceptionInd()
|
||||
{
|
||||
auto faultyThread = sscl::ComponentThread::getSelf();
|
||||
auto mrntt = sscl::ComponentThread::getMrntt();
|
||||
@@ -199,5 +199,5 @@ void sscl::mrntt::MarionetteComponent::exceptionInd()
|
||||
request.get(), request)));
|
||||
}
|
||||
|
||||
} // namespace mrntt
|
||||
} // namespace pptr
|
||||
} // namespace sscl
|
||||
|
||||
+17
-18
@@ -14,13 +14,11 @@
|
||||
#include <mindManager/mindManager.h>
|
||||
#include <salmanoff.h>
|
||||
|
||||
// Define the global marionette thread instance (declared extern in libspinscale)
|
||||
// Define the global puppeteer thread instance (declared extern in libspinscale)
|
||||
namespace sscl {
|
||||
namespace mrntt {
|
||||
std::shared_ptr<MarionetteThread> thread = std::make_shared<MarionetteThread>();
|
||||
} // namespace mrntt
|
||||
namespace pptr {
|
||||
|
||||
namespace mrntt {
|
||||
std::shared_ptr<PuppeteerThread> thread = std::make_shared<PuppeteerThread>();
|
||||
std::atomic<int> exitCode;
|
||||
MarionetteComponent mrntt(std::static_pointer_cast<sscl::ComponentThread>(thread));
|
||||
|
||||
@@ -41,7 +39,8 @@ void marionetteFinalizeReqCb(bool success)
|
||||
std::cout << __func__ << ": Marionette finalized." << '\n';
|
||||
exitMarionetteLoop();
|
||||
}
|
||||
} // namespace mrntt
|
||||
|
||||
} // namespace pptr
|
||||
} // namespace sscl
|
||||
|
||||
namespace smo {
|
||||
@@ -57,8 +56,8 @@ void marionetteInitializeReqCb(bool success)
|
||||
std::cerr << __func__ << ": Failed to initialize Marionette. Shutting down."
|
||||
<< '\n';
|
||||
|
||||
sscl::mrntt::mrntt.finalizeReq({nullptr, std::bind(
|
||||
&sscl::mrntt::marionetteFinalizeReqCb,
|
||||
sscl::pptr::mrntt.finalizeReq({nullptr, std::bind(
|
||||
&sscl::pptr::marionetteFinalizeReqCb,
|
||||
std::placeholders::_1)});
|
||||
}
|
||||
|
||||
@@ -66,7 +65,7 @@ void marionetteInitializeReqCb(bool success)
|
||||
|
||||
namespace sscl {
|
||||
|
||||
void MarionetteThread::main(MarionetteThread& self)
|
||||
void PuppeteerThread::main(PuppeteerThread& self)
|
||||
{
|
||||
std::string threadName = "smo:" + self.name;
|
||||
pthread_setname_np(pthread_self(), threadName.c_str());
|
||||
@@ -74,7 +73,7 @@ void MarionetteThread::main(MarionetteThread& self)
|
||||
std::cout << __func__ << ": Waiting for command line JOLT" << std::endl;
|
||||
self.getIoService().run();
|
||||
self.initializeTls();
|
||||
sscl::mrntt::exitCode = EXIT_SUCCESS;
|
||||
sscl::pptr::exitCode = EXIT_SUCCESS;
|
||||
static boost::asio::signal_set signals(self.getIoService(), SIGINT);
|
||||
bool callShutdownSalmanoff = false;
|
||||
|
||||
@@ -96,8 +95,8 @@ void MarionetteThread::main(MarionetteThread& self)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
sscl::mrntt::mrntt.finalizeReq({nullptr, std::bind(
|
||||
&sscl::mrntt::marionetteFinalizeReqCb,
|
||||
sscl::pptr::mrntt.finalizeReq({nullptr, std::bind(
|
||||
&sscl::pptr::marionetteFinalizeReqCb,
|
||||
std::placeholders::_1)});
|
||||
}
|
||||
);
|
||||
@@ -140,7 +139,7 @@ void MarionetteThread::main(MarionetteThread& self)
|
||||
callShutdownSalmanoff = true;
|
||||
|
||||
// Create new Mind instance just before initializeReq
|
||||
sscl::mrntt::mrntt.initializeReq({nullptr, std::bind(
|
||||
sscl::pptr::mrntt.initializeReq({nullptr, std::bind(
|
||||
&smo::marionetteInitializeReqCb, std::placeholders::_1)});
|
||||
|
||||
std::cout << __func__ << ": Entering event loop" << "\n";
|
||||
@@ -184,8 +183,8 @@ void MarionetteThread::main(MarionetteThread& self)
|
||||
|
||||
if (sendExceptionInd)
|
||||
{
|
||||
sscl::mrntt::exitCode = EXIT_FAILURE;
|
||||
sscl::mrntt::mrntt.exceptionInd();
|
||||
sscl::pptr::exitCode = EXIT_FAILURE;
|
||||
sscl::pptr::mrntt.exceptionInd();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +197,7 @@ void MarionetteThread::main(MarionetteThread& self)
|
||||
|
||||
if (typeid(e) == typeid(OptionsParserError))
|
||||
{
|
||||
sscl::mrntt::exitCode = EXIT_FAILURE;
|
||||
sscl::pptr::exitCode = EXIT_FAILURE;
|
||||
out = &std::cerr;
|
||||
outUsageMsg = std::string(__func__) + ": ";
|
||||
}
|
||||
@@ -209,12 +208,12 @@ void MarionetteThread::main(MarionetteThread& self)
|
||||
{
|
||||
std::cerr << __func__ << ": Exception occurred: " << e.what()
|
||||
<< std::endl;
|
||||
sscl::mrntt::exitCode = EXIT_FAILURE;
|
||||
sscl::pptr::exitCode = EXIT_FAILURE;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
std::cerr << __func__ << ": Unknown exception occurred" << std::endl;
|
||||
sscl::mrntt::exitCode = EXIT_FAILURE;
|
||||
sscl::pptr::exitCode = EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (callShutdownSalmanoff) {
|
||||
|
||||
+2
-2
@@ -227,7 +227,7 @@ void Mind::initializeReq(sscl::Callback<mindLifetimeMgmtOpCbFn> callback)
|
||||
auto request = std::make_shared<MindLifetimeMgmtOp>(
|
||||
*this, caller, callback);
|
||||
|
||||
sscl::mrntt::mrntt.thread->getIoService().post(
|
||||
sscl::pptr::mrntt.thread->getIoService().post(
|
||||
STC(std::bind(
|
||||
&MindLifetimeMgmtOp::initializeReq1_posted,
|
||||
request.get(), request)));
|
||||
@@ -239,7 +239,7 @@ void Mind::finalizeReq(sscl::Callback<mindLifetimeMgmtOpCbFn> callback)
|
||||
auto request = std::make_shared<MindLifetimeMgmtOp>(
|
||||
*this, caller, callback);
|
||||
|
||||
sscl::mrntt::mrntt.thread->getIoService().post(
|
||||
sscl::pptr::mrntt.thread->getIoService().post(
|
||||
STC(std::bind(
|
||||
&MindLifetimeMgmtOp::finalizeReq1_posted,
|
||||
request.get(), request)));
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace smo {
|
||||
|
||||
void MindThread::handleException()
|
||||
{
|
||||
sscl::mrntt::mrntt.exceptionInd();
|
||||
sscl::pptr::mrntt.exceptionInd();
|
||||
}
|
||||
|
||||
} // namespace smo
|
||||
|
||||
Reference in New Issue
Block a user