Tidying
This commit is contained in:
@@ -40,6 +40,8 @@ namespace Services
|
||||
* If `instructions` does not contain the subsequent instruction, we'll just return std::nullopt for
|
||||
* instructions that skip the subsequent instruction.
|
||||
*
|
||||
* TODO: Why can't we just pass in the next instruction here? Instead of passing in the entire mapping?
|
||||
*
|
||||
* @return
|
||||
* The destination byte address the subject instruction may jump to, if we were able to resolve it.
|
||||
* Otherwise, std::nullopt.
|
||||
|
||||
@@ -19,7 +19,6 @@ void SignalHandler::run() {
|
||||
|
||||
const auto& handlerIt = this->handlersBySignalNum.find(signalNumber);
|
||||
if (handlerIt != this->handlersBySignalNum.end()) {
|
||||
// We have a registered handler for this signal.
|
||||
handlerIt->second();
|
||||
}
|
||||
}
|
||||
@@ -37,15 +36,14 @@ void SignalHandler::startup() {
|
||||
this->setName("SH");
|
||||
this->threadState = ThreadState::STARTING;
|
||||
Logger::debug("Starting SignalHandler");
|
||||
|
||||
// Block all signal interrupts
|
||||
auto signalSet = this->getRegisteredSignalSet();
|
||||
::sigprocmask(SIG_SETMASK, &signalSet, NULL);
|
||||
|
||||
// Register handlers
|
||||
this->handlersBySignalNum.emplace(SIGINT, std::bind(&SignalHandler::triggerApplicationShutdown, this));
|
||||
this->handlersBySignalNum.emplace(SIGTERM, std::bind(&SignalHandler::triggerApplicationShutdown, this));
|
||||
|
||||
// It's possible that the SignalHandler has been instructed to shut down, before it could finish starting up.
|
||||
if (this->getThreadState() != ThreadState::SHUTDOWN_INITIATED) {
|
||||
this->threadState = ThreadState::READY;
|
||||
}
|
||||
@@ -54,7 +52,7 @@ void SignalHandler::startup() {
|
||||
::sigset_t SignalHandler::getRegisteredSignalSet() const {
|
||||
auto set = ::sigset_t{};
|
||||
if (::sigfillset(&set) == -1) {
|
||||
throw Exceptions::Exception("::sigfillset() failed - error number: " + std::to_string(errno));
|
||||
throw Exceptions::Exception{"::sigfillset() failed - error number: " + std::to_string(errno)};
|
||||
}
|
||||
|
||||
return set;
|
||||
@@ -65,7 +63,6 @@ void SignalHandler::triggerApplicationShutdown() {
|
||||
this->shutdownSignalsReceived++;
|
||||
|
||||
if (this->shutdownSignalsReceived > 1) {
|
||||
// User has likely run out of patience
|
||||
Logger::warning("Aborting immediately");
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -861,7 +861,7 @@ namespace TargetController
|
||||
if (cacheIt == this->programMemoryCachesByAddressSpaceKey.end()) {
|
||||
cacheIt = this->programMemoryCachesByAddressSpaceKey.emplace(
|
||||
addressSpaceDescriptor.key,
|
||||
TargetMemoryCache(addressSpaceDescriptor)
|
||||
TargetMemoryCache{addressSpaceDescriptor}
|
||||
).first;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user