Michael,
Sorry to have to ask, but: Why?
Unless you’re building a debugger or some such, there’s really no valid case
for “Must not be interrrupt by another thread”. There’s probably something
wrong in your design if “must” do this. You should ever only need to block
threads that are accessing the same data as your own thread.
However, if you really want to do BAD design in your driver, a KeRaiseIRQL()
call with sufficently high IRQL will do the job. Obviously followed by
KeLowerIRQL(oldIRQL). [OldIRQL is passed back from the Raise function]
It’s EXTREMELY bad practice to do this, however.
You should never do this in a production driver.
If you explain what you’re trying to achieve, to the members of this mailing
list, I’m sure someone will suggest some suitable solution to the problem.
Further, unless this lock is really short, you’ll be in trouble with
Microsoft once they start using the “maximum interrupt latency” method to
achieve real time video and audio, which states that any driver must not
block interrupts for more than X microseconds per second. If you block all
interrupts and/or threads, you probably can’t fulfill this criteria, unless
it’s like three lines of code in between raise and lower IRQL.
–
Mats
-----Original Message-----
From: xxxxx@sonydadc.com [mailto:xxxxx@sonydadc.com]
Sent: Tuesday, January 13, 2004 4:05 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] global kernel lock
Hello,
I have a small piece of code within my driver, which must not be interrupted
by any other thread.
My 1st thought was to use _asm cli, but I dont know if this will work on
multi processor systems
(or even p4 with hyperthreading) as well.
Is there an API call to prevent interruption?
Or what is the proper way to achieve this.
Best Regards
Michael
— 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