简体   繁体   English

Windows中具有PTHREAD的互斥锁?

[英]Mutex with PTHREAD in Windows?

当线程调用pthread_exit(NULL)终止其执行时,其互斥锁是否可用?

From the documentation of pthread_exit : 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. pthread_exit()函数应终止调用线程,并使value_ptr值可用于与终止线程的任何成功连接。 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. 线程终止不会释放任何应用程序可见的进程资源,包括但不限于互斥锁和文件描述符,也不执行任何进程级别的清理操作,包括但不限于调用可能存在的任何atexit()例程。

So no, your mutex will not be released. 因此,不会,您的互斥锁将不会被释放。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM