blob: 4ad2a7be1db731ee89d8a2df38ae9f244ff46b9f (
plain) (
blame)
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
38
39
40
41
42
43
44
45
46
47
48
49
|
--- server/mozc_server.cc.org 2010-11-06 10:54:20.721190331 +0900
+++ server/mozc_server.cc 2010-11-06 10:55:39.283188573 +0900
@@ -30,6 +30,9 @@
#ifdef OS_WINDOWS
#include <windows.h>
#endif
+#ifdef __FreeBSD__
+#include <signal.h>
+#endif
#include "base/base.h"
#include "base/process.h"
@@ -46,6 +49,23 @@
mozc::SessionServer *g_session_server = NULL;
}
+#ifdef __FreeBSD__
+static void sig_func(int num)
+{
+ VLOG(1) << "signal " << num << " recieved.";
+ switch (num) {
+ case SIGINT:
+ case SIGHUP:
+ case SIGTERM:
+ if (g_session_server)
+ g_session_server->Terminate();
+ break;
+ default:
+ break;
+ }
+}
+#endif
+
namespace mozc {
namespace {
@@ -122,6 +142,12 @@
return -1;
}
+#ifdef __FreeBSD__
+ ::signal(SIGINT, sig_func);
+ ::signal(SIGHUP, sig_func);
+ ::signal(SIGTERM, sig_func);
+#endif
+
// Create a new thread.
// We can't call Loop() as Loop() doesn't make a thread.
// We have to make a thread here so that ShutdownSessionCallback()
|