gpt4 book ai didi

c++ - 如果我不关心返回值,是否需要 pthread_exit

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:24:16 26 4
gpt4 key购买 nike

如果我不关心线程的返回状态,是否需要 pthread_exit?

我想知道是否可能存在与在我的数据化 pthread 中不调用 pthread_exit 相关的一些微妙的资源问题。

谢谢。

最佳答案

pthread_exit() 的目的是在任何其他线程加入 时返回退出代码。

来自manual :

   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.

因此,如果您不使用它,则没有任何区别。

关于c++ - 如果我不关心返回值,是否需要 pthread_exit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13990067/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com