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