diff options
author | Oleg Krotenko <OKrotenko@luxoft.com> | 2015-07-27 14:23:10 +0300 |
---|---|---|
committer | Oleg Krotenko <OKrotenko@luxoft.com> | 2015-07-28 17:38:14 +0300 |
commit | 09fb62fc3731899e94fb068d02f411e449e8d8cd (patch) | |
tree | 9d96ca22503eca297b7485ffb1524da788d84570 | |
parent | f261a06bbfb133d1662943e3b269906fa1fc0a5a (diff) | |
download | smartdevicelink-09fb62fc3731899e94fb068d02f411e449e8d8cd.tar.gz |
Fixing of core dumps when executing IGNITION_OFF. APPLINK-11950
4 files changed, 10 insertions, 5 deletions
diff --git a/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h b/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h index 4df0fd19f..e00408f24 100644 --- a/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h +++ b/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h @@ -110,6 +110,7 @@ class HeartBeatMonitor: public threads::ThreadDelegate { sync_primitives::Lock sessions_list_lock_; // recurcive sync_primitives::Lock main_thread_lock_; mutable sync_primitives::Lock heartbeat_timeout_seconds_lock_; + sync_primitives::ConditionalVariable heartbeat_monitor_; volatile bool run_; diff --git a/src/components/connection_handler/src/heartbeat_monitor.cc b/src/components/connection_handler/src/heartbeat_monitor.cc index fdb3208d0..fd081c331 100644 --- a/src/components/connection_handler/src/heartbeat_monitor.cc +++ b/src/components/connection_handler/src/heartbeat_monitor.cc @@ -81,7 +81,7 @@ void HeartBeatMonitor::threadMain() { logger_, "Start heart beat monitor. Timeout is " << default_heartbeat_timeout_); while (run_) { - usleep(kDefaultCycleTimeout); + heartbeat_monitor_.Wait(main_lock); Process(); } } @@ -128,8 +128,9 @@ void HeartBeatMonitor::exitThreadMain() { // FIXME (dchmerev@luxoft.com): thread requested to stop should stop as soon as possible, // not running one more iteration before actual stop LOG4CXX_AUTO_TRACE(logger_); - run_ = false; AutoLock main_lock(main_thread_lock_); + run_ = false; + heartbeat_monitor_.NotifyOne(); } void HeartBeatMonitor::set_heartbeat_timeout_seconds(int32_t timeout, diff --git a/src/components/include/utils/message_queue.h b/src/components/include/utils/message_queue.h index a187328e1..e0b333672 100644 --- a/src/components/include/utils/message_queue.h +++ b/src/components/include/utils/message_queue.h @@ -158,11 +158,12 @@ template<typename T, class Q> void MessageQueue<T, Q>::push(const T& element) { { sync_primitives::AutoLock auto_lock(queue_lock_); if (shutting_down_) { - CREATE_LOGGERPTR_LOCAL(logger_, "Utils") - LOG4CXX_ERROR(logger_, "Runtime error, pushing into queue" + CREATE_LOGGERPTR_LOCAL(logger_, "Utils") + LOG4CXX_ERROR(logger_, "Runtime error, pushing into queue" " that is being shut down"); + return; } - queue_.push(element); + queue_.push(element); } queue_new_items_.Broadcast(); } diff --git a/src/components/media_manager/src/pipe_streamer_adapter.cc b/src/components/media_manager/src/pipe_streamer_adapter.cc index b3f94a6e0..2b2167934 100644 --- a/src/components/media_manager/src/pipe_streamer_adapter.cc +++ b/src/components/media_manager/src/pipe_streamer_adapter.cc @@ -88,6 +88,8 @@ void PipeStreamerAdapter::StartActivity(int32_t application_key) { current_application_ = application_key; is_ready_ = true; + messages_.Reset(); + for (std::set<MediaListenerPtr>::iterator it = media_listeners_.begin(); media_listeners_.end() != it; ++it) { |