当线程终止执行调用 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/