This is an automated email from the ASF dual-hosted git repository.
nwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git
The following commit(s) were added to refs/heads/master by this push:
new 2bfe579 EventLoop Signal Handler (#3212)
2bfe579 is described below
commit 2bfe579dd3f16871fd42aa23c3800fa13576d71f
Author: Xiaoyao Qian <[email protected]>
AuthorDate: Mon Mar 11 16:40:54 2019 -0700
EventLoop Signal Handler (#3212)
---
heron/common/src/cpp/network/event_loop_impl.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/heron/common/src/cpp/network/event_loop_impl.cpp
b/heron/common/src/cpp/network/event_loop_impl.cpp
index c37fc7e..b7de06d 100644
--- a/heron/common/src/cpp/network/event_loop_impl.cpp
+++ b/heron/common/src/cpp/network/event_loop_impl.cpp
@@ -76,7 +76,14 @@ EventLoopImpl::~EventLoopImpl() {
event_base_free(mDispatcher);
}
+static void handleTerm(evutil_socket_t _, sp_int16 what, void* ctx) {
+ struct event_base *evb = (struct event_base*) ctx;
+ event_base_loopbreak(evb);
+}
+
void EventLoopImpl::loop() {
+ struct event *term = evsignal_new(mDispatcher, SIGTERM, handleTerm,
mDispatcher);
+ event_add(term, NULL);
// This never returns
event_base_dispatch(mDispatcher);
}