This commit is contained in:
Nav
2021-11-17 21:45:56 +00:00
parent 3fee62d5ea
commit e45a235d22
3 changed files with 10 additions and 4 deletions

View File

@@ -99,7 +99,7 @@ void Application::startup() {
this->blockAllSignalsOnCurrentThread(); this->blockAllSignalsOnCurrentThread();
this->signalHandlerThread = std::thread(&SignalHandler::run, std::ref(this->signalHandler)); this->signalHandlerThread = std::thread(&SignalHandler::run, std::ref(this->signalHandler));
Logger::info("Selected environment: " + this->selectedEnvironmentName); Logger::info("Selected environment: \"" + this->selectedEnvironmentName + "\"");
Logger::debug("Number of environments extracted from config: " Logger::debug("Number of environments extracted from config: "
+ std::to_string(this->applicationConfig.environments.size())); + std::to_string(this->applicationConfig.environments.size()));
@@ -153,7 +153,10 @@ void Application::shutdown() {
// Signal handler is still running // Signal handler is still running
this->signalHandler.triggerShutdown(); this->signalHandler.triggerShutdown();
// Send meaningless signal to the SignalHandler thread to have it shutdown. /*
* Send meaningless signal to the SignalHandler thread to have it shutdown. The signal will pull it out of a
* blocking state and allow it to action the shutdown. See SignalHandler::run() for more.
*/
pthread_kill(this->signalHandlerThread.native_handle(), SIGUSR1); pthread_kill(this->signalHandlerThread.native_handle(), SIGUSR1);
} }

View File

@@ -7,7 +7,10 @@ using namespace Bloom;
void ApplicationConfig::init(const QJsonObject& jsonObject) { void ApplicationConfig::init(const QJsonObject& jsonObject) {
if (!jsonObject.contains("environments")) { if (!jsonObject.contains("environments")) {
throw Exceptions::InvalidConfig("No environments found."); throw Exceptions::InvalidConfig(
"No environments found - please review the bloom.json configuration file and ensure that "
"no syntax errors are present."
);
} }
// Extract all environment objects from JSON config. // Extract all environment objects from JSON config.

View File

@@ -41,7 +41,7 @@ void SignalHandler::startup() {
auto signalSet = this->getRegisteredSignalSet(); auto signalSet = this->getRegisteredSignalSet();
sigprocmask(SIG_SETMASK, &signalSet, NULL); sigprocmask(SIG_SETMASK, &signalSet, NULL);
// Register handlers here // Register handlers
this->handlersMappedBySignalNum.insert(std::pair( this->handlersMappedBySignalNum.insert(std::pair(
SIGINT, SIGINT,
std::bind(&SignalHandler::triggerApplicationShutdown, this) std::bind(&SignalHandler::triggerApplicationShutdown, this)