masayuki2009 commented on PR #8486:
URL: https://github.com/apache/nuttx/pull/8486#issuecomment-1425187600

   >Is this testing the child return code ? I'm very confused. The original 
test seems to be a bit incomplete, as it sets #define >RETURN_STATUS 14 for 
every one and then tests if all return this.
   
   Yes, all child tasks execute `waitpid_main()` which return the maginal 
number (i.e. RETURN_STATUS (14)).
   
   ```
   static int waitpid_main(int argc, char *argv[])
   {
     pid_t me = getpid();
   
     printf("waitpid_main: PID %d Started\n", me);
     sleep(3);
     printf("waitpid_main: PID %d exitting with result=%d\n",
             me, RETURN_STATUS);
     return RETURN_STATUS;
   }
   ```
   
   Actually, we can see them in the log.
   
   ```
   waitpid_main: PID 7 Started
   waitpid_main: PID 11 Started
   waitpid_main: PID 12 Started
   waitpid_main: PID 7 exitting with result=14
   waitpid_main: PID 11 exitting with result=14
   waitpid_main: PID 12 exitting with result=14
   ```
   
   >It seems to me that all the return codes just bucketed into this magical 
number 14 before, and this no longer happens.
   
   However, it seems that waitpid() for the last child task obtains a different 
status code (i.e. 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.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

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

Reply via email to