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



##########
File path: examples/leds/leds_main.c
##########
@@ -59,6 +45,26 @@ static bool g_led_daemon_started;
  * Private Functions
  ****************************************************************************/
 
+/****************************************************************************
+ * Name: sigterm_action
+ ****************************************************************************/
+
+void sigterm_action(int signo, siginfo_t *siginfo, void *arg)

Review comment:
       add static

##########
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);
     }
 
-errout_with_fd:
-  close(fd);
+  errout_with_fd:
+    close(fd);
 
-errout:
-  g_led_daemon_started = false;
+  errout:
+    g_led_daemon_started = false;

Review comment:
       why change from line 176-182




-- 
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:
[email protected]


Reply via email to