哪个线程持有锁
我正在使用 C 语言,并且有一个正在调试的多线程(两个线程)进程的核心转储。 我在 gdb 中看到,在极少数情况下,两个线程都会获取 mutex_lock。有没有办法可以检查 gdb 中拥有锁的线程? 我正在运行一种Linux风格.. 另外,我不允许发布代码,因为它是专有的。
I am working on C and I have a core dump of a multithreaded (two threads) process that I am debugging.
I see in gdb that the mutex_lock is acquired by both the threads under a rare situation. Is there a way I could check the thread that possess the lock in gdb?
I am running a flavor of linux..
Also, I am not allowed to post the code since it's proprietary.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在获取和释放相关锁的每一行(当然更改 printf 文本),执行以下操作:
On every line that gets and releases the lock in question (of course change the printf text), do the following: