This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center
                            
                        
                    
                
                                6年前关闭。
            
                    
https://computing.llnl.gov/tutorials/pthreads/samples/join.c

请在上面的链接中查看代码。


在main()中的pthread_join之后执行pthread_exit有什么好处吗?

最佳答案

pthread_exit()的POSIX规范来看,使用pthread_exit()代替exit()_exit()return没有太大的好处。从名义上讲,这意味着未执行atexit()处理程序,并且可能意味着未刷新文件流-更像是_exit()。在示例代码的上下文中,似乎没有必要。

关于c - 在main()中的pthread_join之后执行pthread_exit有好处吗? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16703461/

10-10 20:40