Курсовая работа: Реализация системы управления реального времени в ОС Windows
TRACE("TimerThread Priority: %d",priority);
SetTimer();
while(!bExitThread)
{KeWaitForSingleObject(&kTimer,
Executive,KernelMode,FALSE,0);
if (bExitThread) break;
LONG state = KeReadStateEvent(&kEvent);
if (state == 0)
{TRACE("TimerThreadProc: KeSetEvent");
KeSetEvent(&kEvent,FALSE,FALSE);}
else
{TRACE("[!] Event already in signaled "
"state; aborted");
bTimerWorks = false;
break;}}
KillTimer();
TRACE("<- TimerThreadProc, exiting");
PsTerminateSystemThread(STATUS_SUCCESS);}
Приложение 2
Исходный код рабочего потока
VOID ThreadProc(PVOID startContext)
{TRACE("-> ThreadProc, IRQL = %d",KeGetCurrentIrql());
KeSetPriorityThread((PKTHREAD)pThread,curSett.Priority);
for(int i = 0;!bExitThread;i++)
{TRACE("* ThreadProc: loop %d, "
"priority %d",i,
KeQueryPriorityThread((PKTHREAD)pThread));
KeWaitForSingleObject(&kEvent,Executive,KernelMode,
FALSE,0);
if (bExitThread) break;