Hi,
Created a thread in the driver and it will be running at HIGH_PRIORITY, and
I need to stop the thread by setting an event from an another dispatch Call,
which is running at PASSIVE_LEVEL.
Since the thread is running at HIGH_PRIORITY, the dispatch function is not
getting able to set the event.
Is it right to raise the IRQL in the dispatch cuntion to IRQL=DISPATCH LEVEL
before KeSEtEvent, and lower the IRQL down.
Thanks
> Is it right to raise the IRQL in the dispatch cuntion to IRQL=DISPATCH LEVEL
before KeSEtEvent, and lower the IRQL down.
Surely you can do this - the only question is what are you going to achieve this way…
Please think about it carefully, and you will realize that you are still in exactly the same position.
Look - in order to for KeRaiseIrql() to get invoked in context of lower priority thread, this thread has to get its CPU slice, in the first place, and it has no chance to do it because CPU is running a thread of higher priority that does not want to yield execution . In other words, you are not going to achieve anything this way - you are still in exactly the same position.
Second, and even more important, setting event may result in preemption only if some thread of even higher priority is waiting on this event, but it does not really seem to be the case here, does it???
To summarize, your way of thinking is just totally illogical. If you want highest-priority thread to yield CPU it has to voluntarily yield execution by KeWaitXXX(), KeDelayExecutionThread(), etc, and it has to do it itself. Period.
Anton Bassov
If your call to KeSetEvent is not getting made, neither will your attempt to raise IRQL b/c you will be facing the same starvation issues…the dispatch function cannot execute any code, let alone change the IRQL (which KeSetEvent would do internally anyways). You need to make your high priority thread more friendly w/the rest of the OS.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@techie.com
Sent: Tuesday, May 20, 2008 8:20 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Stopping a HIGH_PRIORITY thread
Hi,
Created a thread in the driver and it will be running at HIGH_PRIORITY, and
I need to stop the thread by setting an event from an another dispatch Call,
which is running at PASSIVE_LEVEL.
Since the thread is running at HIGH_PRIORITY, the dispatch function is not
getting able to set the event.
Is it right to raise the IRQL in the dispatch cuntion to IRQL=DISPATCH LEVEL
before KeSEtEvent, and lower the IRQL down.
Thanks
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer