2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Contact: Jan Olszak (j.olszak@samsung.com)
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License
21 * @author Jan Olszak (j.olszak@samsung.com)
22 * @brief Definition of the Runner class, that manages daemon's lifetime
30 #include "logger/logger.hpp"
31 #include "utils/glib-loop.hpp"
32 #include "utils/latch.hpp"
38 namespace zone_daemon {
52 utils::Latch gSignalLatch;
54 void signalHandler(const int sig)
56 LOGI("Got signal " << sig);
64 signal(SIGINT, signalHandler);
65 signal(SIGTERM, signalHandler);
67 LOGI("Starting Zone Daemon...");
69 utils::ScopedGlibLoop loop;
70 LOGI("Zone Daemon started");
72 // Connects to dbus and registers API
73 zone_daemon::Daemon daemon;
77 LOGI("Stopping Zone Daemon...");
80 LOGI("Daemon stopped");
83 void Runner::terminate()
85 LOGI("Terminating Zone Daemon");
89 } // namespace zone_daemon