RE: Mutex
- From: Hasitha <Hasitha@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 28 Sep 2007 02:35:01 -0700
Thanks mirage2k2.
i try to use ExAcquireFastMutex(). its works but when i try to unload the
driver it will crash.(Blue screen). Do u have any idea.
"mirage2k2" wrote:
I am not sure because I have not used them and the help is not helpful! I.
would guess that the signaled state might change as a result of acquiring and
releasing the mutex ... but I see no acquire function in the help!
I normally wait on event objects - the signaled state is changed using
keSetEvent() and KeResetEvent() ... (the object can also be autoclearing
which is useful)
I have also used fast mutex, they are easy you just call
ExAcquireFastMutex() to attempt to acquire the mutex - if mutex is already
acquired then your thread waits until other thread releases it.
"Hasitha" wrote:
Thankx for the answer.
You will need to change state to not signalled before waiting.how should i change the state. What kind of command should i use for it.
"mirage2k2" wrote:
The mutex is initialized in the signalled state so your initial wait will not
wait - since object is already signalled.
You will need to change state to not signalled before waiting.
"Hasitha" wrote:
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);
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
- Prev by Date: Raw write access in vista
- Next by Date: raw write access in vista
- Previous by thread: RE: Mutex
- Next by thread: Re: Mutex
- Index(es):
Relevant Pages
|