blob: d8cd07d3b1d76e19f39940be0f2fc8aaf49eb3b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
#include <csignal>
#endif
#include <vsomeip/vsomeip.hpp>
#include "hello_world_client.hpp"
#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
hello_world_client *hw_cl_ptr(nullptr);
void handle_signal(int _signal) {
if (hw_cl_ptr != nullptr &&
(_signal == SIGINT || _signal == SIGTERM))
hw_cl_ptr->stop();
}
#endif
int main(int argc, char **argv)
{
(void)argc;
(void)argv;
hello_world_client hw_cl;
#ifndef VSOMEIP_ENABLE_SIGNAL_HANDLING
hw_cl_ptr = &hw_cl;
signal(SIGINT, handle_signal);
signal(SIGTERM, handle_signal);
#endif
if (hw_cl.init()) {
hw_cl.start();
return 0;
} else {
return 1;
}
}
|