gpt4 book ai didi

c - 是否有必要调用 pthread_exit()

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

我创建了 2 个没有任何 pthread_exit() 的线程,并添加了 2 个 pthread_join()
有什么问题吗?是否可以?

最佳答案

您不需要调用 pthread_exit。线程函数可以在完成时简单地返回。

来自手册页:

An implicit call to pthread_exit() is made when a thread other than the thread in which main() was first invoked returns from the start routine that was used to create it. The function's return value serves as the thread's exit status.

关于c - 是否有必要调用 pthread_exit(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33586465/

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