case WAIT_OBJECT_0 + 1:
pThis->ProcessDShowEvent();
break;
default:
break;
}
};
RETAILMSG(1,(L"CGraphManager::ThreadProc() is finished\n"));
return 0;
}
但是我看到第一次执行Init()函数的时候并没有执行ThreadProc()函数,ThreadProc()函数是通过其他函数激发的,但是有一个很不明白的问题,我看到激发的函数:
BuildCaptureGraph()
{
RETAILMSG(1,(L"CGraphManager::BuildCaptureGraph() \n"));
// The Graph is built on a separate thread to
// prevent reentrancy issues.
m_currentCommand = COMMAND_BUILDGRAPH;
SetEvent( m_handle[0] );
RETAILMSG(1,(L"CGraphManager::BuildCaptureGraph() after SetEvent \n")); //执行完这句激发ThreadProc
WaitForSingleObject( m_hCommandCompleted, INFINITE );
RETAILMSG(1,(L"CGraphManager::BuildCaptureGraph() end \n"));
return S_OK;
}
BuildCaptureGraph()
{
RETAILMSG(1,(L"CGraphManager::BuildCaptureGraph() \n"));
// The Graph is built on a separate thread to
// prevent reentrancy issues.
m_currentCommand = COMMAND_BUILDGRAPH;
SetEvent( m_handle[0] );
RETAILMSG(1,(L"CGraphManager::BuildCaptureGraph()after SetEvent \n"));//执行完这句激发ThreadProc
WaitForSingleObject( m_hCommandCompleted, INFINITE );
RETAILMSG(1,(L"CGraphManager::BuildCaptureGraph() end \n"));
return S_OK;
}