会发生什么事时,收购了它的线程退出到互斥体? [英] What happens to Mutex when the thread which acquired it exits?

查看:123
本文介绍了会发生什么事时,收购了它的线程退出到互斥体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设有两个线程,主线程和线程说B(由主创建)。若B获得一个互斥体(说pthread_mutex),它已呼吁了pthread_exit在开锁。那么会发生什么情况互斥?它是否成为自由?

Suppose there are two threads, the main thread and say thread B(created by main). If B acquired a mutex(say pthread_mutex) and it has called pthread_exit without unlocking the lock. So what happens to the mutex? Does it become free?

推荐答案

没了。互斥remaines锁定。究竟发生了这样的锁取决于其类型,你可以阅读有关 这里

nope. The mutex remaines locked. What actually happens to such a lock depends on its type, You can read about that here or here

这篇关于会发生什么事时,收购了它的线程退出到互斥体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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