nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-nuttx-apps] RoCorbera commented on a change in pull request #743: add SIGTERM handling in leds example
Date Tue, 01 Jun 2021 13:25:47 GMT

RoCorbera commented on a change in pull request #743:
URL: https://github.com/apache/incubator-nuttx-apps/pull/743#discussion_r643100473



##########
File path: examples/leds/leds_main.c
##########
@@ -170,16 +197,25 @@ static int led_daemon(int argc, char *argv[])
           goto errout_with_fd;
         }
 
-      usleep(500*1000L);
+      usleep(500 * 1000L);
+    }
+
+  /* treats signal termination of the task */
+
+  if (g_led_daemon_started == false)
+    {
+      /* task terminated by a SIGTERM */
+
+      exit(EXIT_SUCCESS);

Review comment:
       The idea was to force the execution of a exit(EXIT_SUCCESS) instead of exiting with
error code (last line if normal flow).
   POSIX exit() terminates the task, closes all fds, etc. I think it is safer.
   I can remove the if(...) { ... }, but the not the exit(EXIT_SUCCESS) given it was correctly
terminated by a SIGTERM at that point.




-- 
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.

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



Mime
View raw message