本文整理汇总了C++中EXECUTE_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ EXECUTE_ASSERT函数的具体用法?C++ EXECUTE_ASSERT怎么用?C++ EXECUTE_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了EXECUTE_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DbgLog
//
// COutputQueuee Destructor :
//
// Free all resources -
//
// Thread,
// Batched samples
//
COutputQueue::~COutputQueue()
{
DbgLog((LOG_TRACE, 3, TEXT("COutputQueue::~COutputQueue")));
/* Free our pointer */
if (m_pInputPin != NULL) {
m_pInputPin->Release();
}
if (m_hThread != NULL) {
{
CAutoLock lck(this);
m_bTerminate = TRUE;
m_hr = S_FALSE;
NotifyThread();
}
DbgWaitForSingleObject(m_hThread);
EXECUTE_ASSERT(CloseHandle(m_hThread));
// The thread frees the samples when asked to terminate
ASSERT(m_List->GetCount() == 0);
delete m_List;
} else {
FreeSamples();
}
if (m_hSem != NULL) {
EXECUTE_ASSERT(CloseHandle(m_hSem));
}
delete [] m_ppSamples;
}
示例2: WaitForSingleObject
// destructor for CAkMsgThread - cleans up any messages left in the
// queue when the thread exited
CAkMsgThread::~CAkMsgThread()
{
#ifdef __Win32__
if(m_hThread != NULL)
{
WaitForSingleObject(m_hThread, INFINITE);
EXECUTE_ASSERT(CloseHandle(m_hThread));
m_hThread =NULL;
}
while (false == m_ThreadQueue.empty())
{
CMsg *pMsg = m_ThreadQueue.front();
delete pMsg;
m_ThreadQueue.pop();
}
if(m_hSem != NULL) {
EXECUTE_ASSERT(CloseHandle(m_hSem));
}
if(m_hQueueLenSem != NULL) {
EXECUTE_ASSERT(CloseHandle(m_hQueueLenSem));
}
#else
//pthread_join(m_threadId, &status);
if(m_threadId != 0)
{
int nret = 0;
void *status = NULL;
nret = pthread_join(m_threadId, &status);
//GetExitCodeThread(m_hThread, lpdwExitCode);
if(0 != nret)
{
fprintf(stderr, "pthread join thread %lu error\n", m_threadId);
}
//fprintf(stderr, "akmsgthread pthread_join thread 0x%lu\n", m_threadId);
m_threadId = 0;
}
while (true != m_ThreadQueue.empty())
{
CMsg *pMsg = m_ThreadQueue.front();
delete pMsg;
m_ThreadQueue.pop();
}
sem_destroy(&m_hSem);
sem_destroy(&m_hQueueLenSem);
#endif
}
示例3: TriggerThread
CBaseReferenceClock::~CBaseReferenceClock() {
if(m_TimerResolution) timeEndPeriod(m_TimerResolution);
m_pSchedule->DumpLinkedList();
if(m_hThread) {
m_bAbort = TRUE;
TriggerThread();
WaitForSingleObject(m_hThread, INFINITE);
EXECUTE_ASSERT(CloseHandle(m_hThread));
m_hThread = 0;
EXECUTE_ASSERT(CloseHandle(m_pSchedule->GetEvent()));
delete m_pSchedule;
}
}
示例4: CheckPointer
//
// GetClassWindowStyles
//
// When we call PrepareWindow in our constructor it will call this method as
// it is going to create the window to get our window and class styles. The
// return code is the class name and must be allocated in static storage. We
// specify a normal window during creation although the window styles as well
// as the extended styles may be changed by the application via IVideoWindow
//
LPTSTR CVideoText::GetClassWindowStyles(DWORD *pClassStyles,
DWORD *pWindowStyles,
DWORD *pWindowStylesEx)
{
CheckPointer(pClassStyles,NULL);
CheckPointer(pWindowStyles,NULL);
CheckPointer(pWindowStylesEx,NULL);
OSVERSIONINFO VersionInfo;
VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
EXECUTE_ASSERT(GetVersionEx(&VersionInfo));
// Default styles for Windows NT systems
*pClassStyles = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNCLIENT;
*pWindowStyles = WS_POPUP | WS_CLIPCHILDREN;
*pWindowStylesEx = (DWORD) 0;
// Make a normal window on Win95 systems
if ((VersionInfo.dwPlatformId & VER_PLATFORM_WIN32_NT) == 0)
*pWindowStyles = WS_POPUP | WS_CAPTION | WS_CLIPCHILDREN;
return TEXT("VideoTextRenderer\0");
} // GetClassWindowStyles
示例5: DbgInitLogTo
void WINAPI DbgInitLogTo(
HKEY hKey) {
LONG lReturn;
DWORD dwKeyType;
DWORD dwKeySize;
TCHAR szFile[MAX_PATH] = {0};
static const TCHAR cszKey[] = TEXT("LogToFile");
dwKeySize = MAX_PATH;
lReturn = RegQueryValueEx(hKey, // Handle to an open key
cszKey, // Subkey name derivation
NULL, // Reserved field
&dwKeyType, // Returns the field type
(LPBYTE) szFile, // Returns the field's value
&dwKeySize); // Number of bytes transferred
// create an empty key if it does not already exist
//
if(lReturn != ERROR_SUCCESS || dwKeyType != REG_SZ) {
dwKeySize = sizeof(TCHAR);
lReturn = RegSetValueEx(hKey, // Handle of an open key
cszKey, // Address of subkey name
(DWORD) 0, // Reserved field
REG_SZ, // Type of the key field
(PBYTE)szFile, // Value for the field
dwKeySize); // Size of the field buffer
}
// if an output-to was specified. try to open it.
//
if(m_hOutput != INVALID_HANDLE_VALUE) {
EXECUTE_ASSERT(CloseHandle(m_hOutput));
m_hOutput = INVALID_HANDLE_VALUE;
}
if(szFile[0] != 0) {
if(!lstrcmpi(szFile, TEXT("Console"))) {
m_hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
if(m_hOutput == INVALID_HANDLE_VALUE) {
AllocConsole();
m_hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
}
SetConsoleTitle(TEXT("ActiveX Debug Output"));
}
else if(szFile[0] &&
lstrcmpi(szFile, TEXT("Debug")) &&
lstrcmpi(szFile, TEXT("Debugger")) &&
lstrcmpi(szFile, TEXT("Deb"))) {
m_hOutput = CreateFile(szFile, GENERIC_WRITE,
FILE_SHARE_READ,
NULL, OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
if(INVALID_HANDLE_VALUE != m_hOutput) {
static const TCHAR cszBar[] = TEXT("\r\n\r\n=====DbgInitialize()=====\r\n\r\n");
SetFilePointer(m_hOutput, 0, NULL, FILE_END);
DbgOutString(cszBar);
}
}
}
}
示例6: ASSERT
//------------------------------------------------------------------------------
// ReallyFree
// called from the destructor (and from Alloc if changing size/count) to
// actually free up the memory
void CCustomAllocator::ReallyFree(void)
{
/* Should never be deleting this unless all buffers are freed */
ASSERT(m_lAllocated == m_lFree.GetCount());
ASSERT(0 == m_lDeliver.GetCount());
/* Free up all the CMediaSamples */
CMediaSample* pSample = m_lFree.RemoveHead();
while (pSample)
{
delete pSample;
pSample = m_lFree.RemoveHead();
}
m_lBuffers.RemoveAll();
m_lAllocated = 0;
// free the block of buffer memory
if (m_pBuffer)
{
EXECUTE_ASSERT(VirtualFree(m_pBuffer, 0, MEM_RELEASE));
m_pBuffer = NULL;
}
return;
}
示例7: WaitForSingleObject
// destructor for CMsgThread - cleans up any messages left in the
// queue when the thread exited
CMsgThread::~CMsgThread() {
if(m_hThread != NULL) {
WaitForSingleObject(m_hThread, INFINITE);
EXECUTE_ASSERT(CloseHandle(m_hThread));
}
POSITION pos = m_ThreadQueue.GetHeadPosition();
while(pos) {
CMsg * pMsg = m_ThreadQueue.GetNext(pos);
delete pMsg;
}
m_ThreadQueue.RemoveAll();
if(m_hSem != NULL) {
EXECUTE_ASSERT(CloseHandle(m_hSem));
}
}
示例8: DbgTerminate
void WINAPI DbgTerminate() {
if(m_hOutput != INVALID_HANDLE_VALUE) {
EXECUTE_ASSERT(CloseHandle(m_hOutput));
m_hOutput = INVALID_HANDLE_VALUE;
}
DeleteCriticalSection(&m_CSDebug);
m_bInit = FALSE;
}
示例9: PostThreadMessage
CWebServer::~CWebServer()
{
if(m_hThread != NULL)
{
PostThreadMessage(m_ThreadId, WM_QUIT, 0, 0);
WaitForSingleObject(m_hThread, 10000);
EXECUTE_ASSERT(CloseHandle(m_hThread));
}
}
示例10: CUnknown
// A derived class may supply a hThreadEvent if it has its own thread that will take care
// of calling the schedulers Advise method. (Refere to CBaseReferenceClock::AdviseThread()
// to see what such a thread has to do.)
CBaseReferenceClock::CBaseReferenceClock( TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr, CAMSchedule * pShed )
: CUnknown( pName, pUnk )
, m_rtLastGotTime(0)
, m_TimerResolution(0)
, m_bAbort( FALSE )
, m_pSchedule( pShed ? pShed : new CAMSchedule(CreateEvent(NULL, FALSE, FALSE, NULL)) )
, m_hThread(0)
{
ASSERT(m_pSchedule);
if (!m_pSchedule)
{
*phr = E_OUTOFMEMORY;
}
else
{
// Set up the highest resolution timer we can manage
TIMECAPS tc;
m_TimerResolution = (TIMERR_NOERROR == timeGetDevCaps(&tc, sizeof(tc)))
? tc.wPeriodMin
: 1;
timeBeginPeriod(m_TimerResolution);
/* Initialise our system times - the derived clock should set the right values */
m_dwPrevSystemTime = timeGetTime();
m_rtPrivateTime = (UNITS / MILLISECONDS) * m_dwPrevSystemTime;
#ifdef PERF
m_idGetSystemTime = MSR_REGISTER(TEXT("CBaseReferenceClock::GetTime"));
#endif
if ( !pShed )
{
DWORD ThreadID;
m_hThread = ::CreateThread(NULL, // Security attributes
(DWORD) 0, // Initial stack size
AdviseThreadFunction, // Thread start address
(LPVOID) this, // Thread parameter
(DWORD) 0, // Creation flags
&ThreadID); // Thread identifier
if (m_hThread)
{
SetThreadPriority( m_hThread, THREAD_PRIORITY_TIME_CRITICAL );
}
else
{
*phr = E_FAIL;
EXECUTE_ASSERT( CloseHandle(m_pSchedule->GetEvent()) );
delete m_pSchedule;
}
}
}
}
示例11: PostThreadMessage
CWebServer::~CWebServer()
{
if (m_hThread != NULL) {
PostThreadMessage(m_ThreadId, WM_QUIT, 0, 0);
if (WaitForSingleObject(m_hThread, 10000) == WAIT_TIMEOUT) {
TerminateThread(m_hThread, 0xDEAD);
}
EXECUTE_ASSERT(CloseHandle(m_hThread));
}
}
示例12: Decommit
//------------------------------------------------------------------------------
// Destructor
//
CCustomAllocator::~CCustomAllocator(void)
{
Decommit();
ReallyFree();
if (m_hSemFree)
{
EXECUTE_ASSERT(CloseHandle(m_hSemFree));
}
}
示例13: cAutoLock
//
// OnPaint
//
// This is called when the window thread receives a WM_PAINT message
//
BOOL CTextOutFilter::OnPaint(COLORREF WindowColor)
{
CAutoLock cAutoLock(&m_RendererLock);
RECT ClientRect;
PAINTSTRUCT ps;
BeginPaint(m_TextWindow.GetWindowHWND(),&ps);
EndPaint(m_TextWindow.GetWindowHWND(),&ps);
// Display the text if we have a sample
if (m_pMediaSample) {
DrawText(m_pMediaSample);
return TRUE;
}
// Create a coloured brush to paint the window
HBRUSH hBrush = CreateSolidBrush(WindowColor);
EXECUTE_ASSERT(GetClientRect(m_TextWindow.GetWindowHWND(),&ClientRect));
EXECUTE_ASSERT(FillRect(m_TextWindow.GetWindowHDC(),&ClientRect,hBrush));
EXECUTE_ASSERT(DeleteObject(hBrush));
return TRUE;
} // OnPaint
示例14: CheckStreaming
STDMETHODIMP CRenderedInputPin::EndOfStream()
{
HRESULT hr = CheckStreaming();
// Do EC_COMPLETE handling for rendered pins
if (S_OK == hr && !m_bAtEndOfStream) {
m_bAtEndOfStream = TRUE;
FILTER_STATE fs;
EXECUTE_ASSERT(SUCCEEDED(m_pFilter->GetState(0, &fs)));
if (fs == State_Running) {
DoCompleteHandling();
}
}
return hr;
}
示例15: PERFLOG_DTOR
CBaseReferenceClock::~CBaseReferenceClock()
{
#ifdef DXMPERF
PERFLOG_DTOR( L"CBaseReferenceClock", (IReferenceClock *) this );
#endif // DXMPERF
if (m_TimerResolution) timeEndPeriod(m_TimerResolution);
if (m_pSchedule)
{
m_pSchedule->DumpLinkedList();
}
if (m_hThread)
{
m_bAbort = TRUE;
TriggerThread();
WaitForSingleObject( m_hThread, INFINITE );
EXECUTE_ASSERT( CloseHandle(m_hThread) );
m_hThread = 0;
EXECUTE_ASSERT( CloseHandle(m_pSchedule->GetEvent()) );
delete m_pSchedule;
}
}