SYMPTOMS
When you run a debug image of Microsoft Windows CE .NET 4.2
that is attached to the debugger, the DebugBreak function causes a breakpoint exception to occur on the following line in
the NextThread kernel call:
DEBUGCHK(GET_RUNSTATE(pth) != RUNSTATE_RUNNING)
When this problem occurs, the debug image stops responding or
restarts.
Note This problem is unusual and might occur in any context.
You cannot verify that this problem is occurring on a retail device that stopped responding or that restarted itself because DEBUGCHK macros only occur on a debug image build.
CAUSE
This problem occurs when an interrupt service thread (IST)
calls the
WaitForSingleObject function at the same time that
the IST owns a critical section. For example, the following code calls the
WaitForSingleObject function in a critical section.
DWORD WINAPI InterruptThread(LPVOID lpParameter)
{
DWORD dwRet;
while(1) {
EnterCriticalSection(&g_CS);
dwRet=WaitForSingleObject(hIntEvent, /*INFINITE*/IST_TIMOUT);
if (dwRet == WAIT_TIMEOUT) {
RETAILMSG(1,(TEXT("WAIT_TIMEOUT\r\n")));
}
if (dwRet == WAIT_OBJECT_0) {
RETAILMSG(1,(TEXT("WAIT_OBJECT_0\r\n")));
}
if (dwRet == WAIT_FAILED) {
RETAILMSG(1,(TEXT("WAIT_FAILED\r\n")));
}
InterruptDone(SYSINTR_TIMING);
LeaveCriticalSection(&g_CS);
}
return 0;
}