BOOL CDebugMsg::WriteLogA(LPSTR pszLog) { #ifdef _WRITEDEBUGMSGLOG BOOL bRet = FALSE; if (WaitForSingleObject(m_hMutex, INFINITE) != WAIT_OBJECT_0) { return bRet; } FILE* fp = _tfopen(m_ptszLogPath, _T("a+")); if (fp) { TCHAR ptszTime[16] = {0}; char pszWriteMsg[MAXDEBUGMSGCHARNUM] = {0}; GetTimeString(ptszTime); USES_CONVERSION; _snprintf(pszWriteMsg, MAXDEBUGMSGCHARNUM, "%s %s\n", T2A(ptszTime), pszLog); fputs(pszWriteMsg, fp); fclose(fp); bRet = TRUE; } ReleaseMutex(m_hMutex); return bRet; #endif return FALSE; }2、Windbg查找Mutex所有者
2.2 查看进程的所有线程及等待状态信息
2.3 查看Mutex所有者线程信息,看是那个线程在占用
2.4 停止内核附加,切换Windbg改用用户态调试附加Demo进程,列出所有线程信息及调用栈
版权声明:本文为博主原创文章,如需转载请说明转至http://blog.csdn.net/gufeng99
原文地址:http://blog.csdn.net/gufeng99/article/details/46753389