Re: Mutex
- From: "Gianluca Varenni" <gianluca.varenni@xxxxxxxxxxxxxxxx>
- Date: Fri, 28 Sep 2007 08:39:34 -0700
"Hasitha" <Hasitha@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:ACAB6067-6853-49D5-827A-EF4FA2036130@xxxxxxxxxxxxxxxx
Hi all,
Thank you very much in advance.
I try to use Mutex in my driver program and it does not work as i expect.
I am try to develop driver to PCi device.
In write function write data to dma data buffer and start DAM and lock
mutex.
When dma finish his job hi will call interrupt callback function. callback
function will unlock the Meutex.
In init function
KeInitializeMutex(&(pDevEex->Mutex),0);
in Write function
WriteDataToDMA();
StartDMA();
while(1)
{
if((NtStatus = KeWaitForMutexObject(&(pDevEex->Mutex), Executive,
KernelMode, FALSE, NULL)==STATUS_SUCCESS){
break;
}
}
In Interrupt callback function
if(!KeReadStateMutex(&(pDevEex->Mutex)))
KeReleaseMutex(&(pDevEex->Mutex),FALSE);
Do you mean Interrupt Service Routine?
You cannot call KeReleaseMutex in your ISR, KeReleaseMutex (as almost all
the other routines working on wait objects) cannot be called at IRQL >
DISPATCH_LEVEL.
What are you trying to accomplish with your design? Acquiring a mutex in a
routine and releasing it in the ISR seems a very very bad idea.
Have a nice day
GV
--
Gianluca Varenni, Windows DDK MVP
CACE Technologies
http://www.cacetech.com
The problem is function do not wait in KeWaitForMutexObject() function and
program loop in while loop.
What wold be the reason for it.
your corporation is highly appreciated.
With Best Regards
Hasitha
.
- Follow-Ups:
- Re: Mutex
- From: Hasitha
- Re: Mutex
- Prev by Date: Re: change original driver install path?
- Next by Date: Re: C++ in KMDF
- Previous by thread: RE: Mutex
- Next by thread: Re: Mutex
- Index(es):
Relevant Pages
|