如果我不关心返回值,我是否需要 pthread_exit [英] Do I need pthread_exit if I don't care of return value

查看:53
本文介绍了如果我不关心返回值,我是否需要 pthread_exit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

If I don't care about the return status of my thread, would I need to have a pthread_exit?

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

I'm wondering if there might be some subtle resource problems associated with not calling pthread_exit in my datached pthreads.

谢谢.

推荐答案

您不必调用 pthread_exit().从线程函数返回也同样有效,并且不会泄漏任何资源(当然,您仍然需要确保您的代码没有任何泄漏).

You don't have to call pthread_exit(). Returning from the thread function would work equally well, and will not leak any resources (of course, you still have to ensure that your code doesn't have any leaks).

这篇关于如果我不关心返回值,我是否需要 pthread_exit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆