Debugging deadlock with pthread mutex(linux)

寵の児 提交于 2019-12-06 13:36:49

The other fields are not particularly useful for debugging deadlocks. The important information is what you've already found - the thread is deadlocking because it is locking a mutex that is already locked by itself.

To debug this with gdb, you could set breakpoints at each line where that mutex is locked by the thread of interest. Each time the breakpoint triggers, just continue execution. When the deadlock happens, the most recent previous lock operation is obviously the one that has no corresponding unlock.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!