You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@heron.apache.org by GitBox <gi...@apache.org> on 2018/07/06 10:43:15 UTC

[GitHub] Glorfischi commented on a change in pull request #2950: Add signal handling to stream manager

Glorfischi commented on a change in pull request #2950: Add signal handling to stream manager
URL: https://github.com/apache/incubator-heron/pull/2950#discussion_r200616860
 
 

 ##########
 File path: heron/common/src/cpp/network/event_loop_impl.cpp
 ##########
 @@ -83,6 +89,39 @@ void EventLoopImpl::loop() {
 
 int EventLoopImpl::loopExit() { return event_base_loopbreak(mDispatcher); }
 
+int EventLoopImpl::registerSignal(int sig, VCallback<EventLoop::Status> cb) {
+  // Create the appropriate structures and init them.
+  auto* event = new SS_RegisteredEvent<sp_int32>(sig, false, std::move(cb), -1);
+  evsignal_set(event->event(), sig, &EventLoopImpl::eventLoopImplSignalCallback, this);
+  if (event_base_set(mDispatcher, event->event()) < 0) {
+    delete event;
+    throw heron::error::Error_Exception(errno);
+  }
+
+  // Now add it to the list of signals monitored by the mDispatcher
+  if (event_add(event->event(), NULL) < 0) {
+    delete event;
+    throw heron::error::Error_Exception(errno);
+  }
+  mSignalEvents[sig] = event;
+  return 0;
+}
+
+int EventLoopImpl::unRegisterSignal(int sig) {
 
 Review comment:
   This function is not actually used yet. I included it, because other events also have a unregister function and it might be useful sometime in the future.
   
   I can also remove it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services