如果我不关心返回值,是否需要pthread_exit?

mon*_*ing 4 c c++ pthreads

如果我不关心我的线程的返回状态,我需要有一个pthread_exit吗?

我想知道在我的数据库pthreads中是否存在与不调用pthread_exit相关的一些细微资源问题.

谢谢.

NPE*_*NPE 5

你不必打电话pthread_exit()。从线程函数返回同样可以很好地工作,并且不会泄漏任何资源(当然,您仍然必须确保您的代码没有任何泄漏)。


P.P*_*.P. 5

目的pthread_exit()是在连接的任何其他线程返回退出代码.

手册:

   Performing a return from the start function of any thread other than the main
   thread results in an implicit call to pthread_exit(), using the function's
   return value as the thread's exit status.
Run Code Online (Sandbox Code Playgroud)

所以,如果你不使用它没有任何区别.