If you are busy waiting at DISPATCH level, I’d expect that the timer isn’t
being updated (or at least, the timer state isn’t being signaled) because
the kernel needs to go into DISPATCH level itself to update those, and when
your driver is in that mode, the kernel can’t do that…
That’s just me guessing, of course.
Busy-waiting at DISPATCH level should be a very quick thing, if at all done.
A much better way would be to schedule a worker thread (using an event of
some sort), let the worker thread deal with the hardware, and when it’s
finished, setting an event to signal that it’s done. Then have another part
of the system wait for this event with a suitable timeout, and if the
timeout happens, signal that hardware is bad.
Of course, this is all hypothetical, since I don’t REALLY know what you’re
doing. But if you’re waiting that long for hardware to be ready that the
Timer can be used to measure the time, you’re probably waiting a bit too
long for DISPATCH level.
–
Mats
-----Original Message-----
From: Quang Vu [mailto:xxxxx@gage-applied.com]
Sent: Friday, June 04, 2004 4:18 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] KeSetTimer() – Detection of timeout at dispatch Level
Importance: High
Hi all,
I wrote a some code to detection timeout using KeSetTimer as following:
KTIMER kTimer;
KeInitializeTimer( &kTimer );
…
BOOL CheckTimeout( LARGE_INTEGER DueTime )
{
KeSetTimer( &m_kTestTimer, DueTime, NULL );
while ( ! HardwareIsReady() )
{
if ( TRUE == KeReadStateTimer( &m_kTestTimer ) )
{
Status = CS_HARDWARE_TIMEOUT; // tineout !!!
return TRUE;
}
}
KeCancelTimer( &m_kTestTimer );
return FALSE;
}
These code work fine at PASSIVE_LEVEL. (ie I’ve got the timeout error )
I use the same code at DISPATCH_LEVEL and I get stucked in while() loop.
It looks like the timer object never get signaled.
What I have done wrong ???
If it is the case how can I detect timeout at DPC level
Thanks for helps,
QUANG
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@3dlabs.com
To unsubscribe send a blank email to xxxxx@lists.osr.com