gpt4 book ai didi

c++ - 在 Windows 中使用 PTHREAD 互斥?

转载 作者:行者123 更新时间:2023-11-28 06:55:50 24 4
gpt4 key购买 nike

当线程终止执行调用 pthread_exit(NULL) 时,它的互斥体是否空闲?

最佳答案

来自 pthread_exit 的文档:

The pthread_exit() function shall terminate the calling thread and make the value value_ptr available to any successful join with the terminating thread. Any cancellation cleanup handlers that have been pushed and not yet popped shall be popped in the reverse order that they were pushed and then executed. After all cancellation cleanup handlers have been executed, if the thread has any thread-specific data, appropriate destructor functions shall be called in an unspecified order. Thread termination does not release any application visible process resources, including, but not limited to, mutexes and file descriptors, nor does it perform any process-level cleanup actions, including, but not limited to, calling any atexit() routines that may exist.

所以不,你的互斥锁不会被释放。

关于c++ - 在 Windows 中使用 PTHREAD 互斥?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23194282/

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