You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "adamdebreceni (via GitHub)" <gi...@apache.org> on 2023/06/07 14:13:25 UTC

[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a diff in pull request #1576: MINIFICPP-2121 - Use std::atomic_flag instead of semaphore

adamdebreceni commented on code in PR #1576:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1576#discussion_r1221672759


##########
minifi_main/MiNiFiMain.cpp:
##########
@@ -91,27 +90,26 @@ static sem_t *process_running;
 
 #ifdef WIN32
 BOOL WINAPI consoleSignalHandler(DWORD signal) {
-  if (!process_running) { exit(0); return TRUE; }
+  if (!process_running.test()) { exit(0); return TRUE; }
   if (signal == CTRL_C_EVENT || signal == CTRL_BREAK_EVENT) {
-    int ret = ETIMEDOUT;
-    while (ret == ETIMEDOUT) {
-      if (flow_controller_running) { sem_post(flow_controller_running); }
-      const struct timespec timeout_100ms { .tv_sec = 0, .tv_nsec = 100000000};
-      ret = sem_timedwait(process_running, &timeout_100ms);
-    }
+    flow_controller_running.clear();
+    flow_controller_running.notify_all();
+    process_running.wait(false);

Review Comment:
   good catch, indeed that seems to be the case



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org