void
CommunicationState::startHeartbeat(const long interval,
const std::function<void()>& heartbeat_impl) {
- startHeartbeatInternal(interval, heartbeat_impl);
+ if (MultiThreadingMgr::instance().getMode()) {
+ std::lock_guard<std::mutex> lk(*mutex_);
+ startHeartbeatInternal(interval, heartbeat_impl);
+ } else {
+ startHeartbeatInternal(interval, heartbeat_impl);
+ }
}
void
void
CommunicationState::stopHeartbeat() {
+ if (MultiThreadingMgr::instance().getMode()) {
+ std::lock_guard<std::mutex> lk(*mutex_);
+ stopHeartbeatInternal();
+ } else {
+ stopHeartbeatInternal();
+ }
+}
+
+void
+CommunicationState::stopHeartbeatInternal() {
if (timer_) {
timer_->cancel();
timer_.reset();
void startHeartbeat(const long interval,
const std::function<void()>& heartbeat_impl);
+ /// @brief Stops recurring heartbeat.
+ void stopHeartbeat();
+
protected:
/// @brief Starts recurring heartbeat.
void startHeartbeatInternal(const long interval = 0,
const std::function<void()>& heartbeat_impl = 0);
-public:
-
/// @brief Stops recurring heartbeat.
- void stopHeartbeat();
+ void stopHeartbeatInternal();
+
+public:
/// @brief Checks if recurring heartbeat is running.
///
void
MySqlConfigBackendImpl::createUpdateOptionDef(const db::ServerSelector& server_selector,
const OptionDefinitionPtr& option_def,
- const std::string& space,
+ const std::string& /*space*/,
const int& /*get_option_def_code_space*/,
const int& insert_option_def,
const int& update_option_def,
_GET_PIDS_NUM=0
# If the PID file exists, get the PID and see if the process is alive.
- if [ -e "${abs_pidfile_path}" ]; then
- pid=$(cat "${abs_pidfile_path}")
+ pid=$(cat "${abs_pidfile_path}" || true)
+ if test -n "${pid}"; then
if kill -0 "${pid}" > /dev/null 2>&1; then
_GET_PID=${pid}
_GET_PIDS_NUM=1