sgysh opened a new pull request #2475:
URL: https://github.com/apache/incubator-nuttx/pull/2475


   ## Summary
   
    - Fix an error that occurs when a waiting task has already finished.
    - Discard the child entry after receiving SIGCHLD.
   
   ## Impact
   
    - waitid
   
   ## Testing
   
   hifive1-revb:nsh (CONFIG_SCHED_HAVE_PARENT=y, CONFIG_SCHED_CHILD_STATUS=y, 
CONFIG_SIG_DEFAULT=y)
   on QEMU
   
   ```
   static int task_main(int argc, char *argv[])
   {
     return 0;
   }
   
   int main(int argc, FAR char *argv[])
   {
     siginfo_t info;
     int pid;
     int ret;
   
     pid = task_create("task", 224, 1024, task_main, NULL);
   
     sleep(1);
   
     ret = waitid(P_PID, pid, &info, WEXITED);
   
     assert(ret == 0);
   
     return 0;
   }
   ```
   
   ```
   static int task_main(int argc, char *argv[])
   {
     sleep(1);
     return 0;
   }
   
   int main(int argc, FAR char *argv[])
   {
     pid_t pid;
     siginfo_t info;
     int ret;
   
     pid = task_create("task1", 224, 1024, task_main, NULL);
     task_create("task2", 224, 1024, task_main, NULL);
   
     waitid(P_PID, pid, &info, WEXITED);
     waitid(P_ALL, 0, &info, WEXITED);
     ret = waitid(P_ALL, 0, &info, WEXITED | WNOHANG);
   
     assert(ret == -1);
   
     return 0;
   }
   ```


----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to