patacongo opened a new issue #4612: URL: https://github.com/apache/incubator-nuttx/issues/4612
The main thread of a task should be able to call pthread_exit(), of course, calling pthread_self() first. Certainly this behavior is not prohibited by the specifications at OpenGroup.org and there are several posts that specifically claim that this is possible. See for example: https://programmer.help/blogs/the-use-of-pthread-exit-in-main-thread.html In this case, the main thread of the process/task group will terminate, but the process/task group will persist and other threads will continue running. I believe that calling pthread_exit() from the main thread will currently lead to an assertion or crash due to the different forms of the main and pthread TCBs and the fact that global data is retained in the main thread's stack. Similarly, a pthread should be able to call exit() and terminate the entire process/ See for example https://www.informit.com/articles/article.aspx?p=2085690&seqNum=5. In fact, this is often the case when exit() is called from a signal handler in a multi-threaded task because we never know for sure which thread the signal handler will run on. Again, a crash would be likely due to the same reasoning. -- 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