summaryrefslogtreecommitdiff
path: root/src/appMain
diff options
context:
space:
mode:
authorAnton Hrytsevich <ahrytsevich>2016-01-19 17:40:13 +0200
committerAnton Hrytsevich <ahrytsevich>2016-02-01 12:30:05 +0200
commit76a15eb52415fdccb8b0c88807dcde2de3be314f (patch)
tree3066f2926bbc9c85c37368b6b41a48ce56b8408c /src/appMain
parent80ce9bae55df6232cd78200a30dfa196b8681803 (diff)
downloadsdl_core-76a15eb52415fdccb8b0c88807dcde2de3be314f.tar.gz
Make refactoring signal catching
It keep simple and minimal code then previous version. Signal mask set once in main thread, than all creating thread copping this mask.
Diffstat (limited to 'src/appMain')
-rw-r--r--src/appMain/life_cycle.cc11
-rw-r--r--src/appMain/main.cc6
2 files changed, 9 insertions, 8 deletions
diff --git a/src/appMain/life_cycle.cc b/src/appMain/life_cycle.cc
index 990251e990..8a106105ad 100644
--- a/src/appMain/life_cycle.cc
+++ b/src/appMain/life_cycle.cc
@@ -1,4 +1,4 @@
-/*
+e*
* Copyright (c) 2014, Ford Motor Company
* All rights reserved.
*
@@ -387,14 +387,9 @@ namespace {
void LifeCycle::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- // First, register signal handlers
- if (!::utils::SubscribeToInterruptSignal(&sig_handler) ||
- !::utils::SubscribeToTerminateSignal(&sig_handler) ||
- !::utils::SubscribeToFaultSignal(&sig_handler)) {
- LOG4CXX_FATAL(logger_, "Subscribe to system signals error");
+ if (!utils::WaitTerminationSignals(&sig_handler)) {
+ LOG4CXX_WARN(logger_, "Fail to catch system signal!");
}
- // Now wait for any signal
- pause();
}
void LifeCycle::StopComponents() {
diff --git a/src/appMain/main.cc b/src/appMain/main.cc
index 9e1a49e2d4..8ec46180a7 100644
--- a/src/appMain/main.cc
+++ b/src/appMain/main.cc
@@ -125,6 +125,12 @@ int32_t main(int32_t argc, char** argv) {
profile::Profile::instance()->config_file_name("smartDeviceLink.ini");
}
+ // Unsibscribe once for all threads
+ if ( utils::UnsibscribeFromTermination() ) {
+ // Can't use internal logger here
+ exit(EXIT_FAILURE);
+ }
+
// Logger initialization
INIT_LOGGER("log4cxx.properties");