**如下:
#include #include #include using namespace std;
critical_section cs_db1;
critical_section cs_db2;
dword winapi threadproc(lpvoid lpparam)
void main()
deletecriticalsection(&cs_db1);
deletecriticalsection(&cs_db2);
}
windbg啟動程式並執行
輸入命令:~*kb,發現兩個地方都有rtlentercriticalsection+0x150
通過命令!cs將臨界區轉儲存出來
觀察owningthread,發現第乙個臨界區被執行緒1c30持有,第二個臨界區被執行緒1864持有,所以產出死鎖。
使用WinDbg分析死鎖
using system using system.threading private void test1 start console.readkey console.writeline exit test1 private void test2 0 000 e clrstack os threa...
WinDbg 除錯互斥體 Mutex 死鎖
include include include handle hmutexa null handle hmutexb null unsigned stdcall threadproc1 void parg unsigned stdcall threadproc2 void parg int main...
Windbg除錯互斥體 Mutex 死鎖
include include include handle hmutexa null handle hmutexb null unsigned stdcall threadproc1 void parg unsigned stdcall threadproc2 void parg int main...