Hi,
I would like to synchronize access to a linked list. This list can be
accessed at DISPATCH_LEVEL and PASSIVE_LEVEL.
I’m using a Mutex, but I’ve two problems:
If I wait with a NULL timer
(KeWaitForMutexObject(&List->Mutex,Executive,KernelMode,FALSE,NULL)) and
I’m at PASSIVE_LEVEL, all is fine.
If I’m at DISPATCH_LEVEL, I get a failed assertion at the call to
KeWaitForMutexObject().
I tried to test the IRQL and set the WaitTime at 0 if I’m at
DISPATCH_LEVEL and then KeWaitForMutexObject() works fine but I get an
exception with KeReleaseMutex() saying I doesn’t own the mutex.
Is there a better way of synchronizing accesses and which works at both
IRQL ?? Should I use a spin lock ?
Any help would be welcome!
Use a spin lock.
-Jeff
-----Original Message-----
From: Nicolas Mugnier [mailto:xxxxx@cesa.fr]
Sent: Thursday, February 13, 2003 10:43 AM
To: NT Developers Interest List
Subject: [ntdev] Synchronization at dispatch level
Hi,
I would like to synchronize access to a linked list. This list can be
accessed at DISPATCH_LEVEL and PASSIVE_LEVEL.
I’m using a Mutex, but I’ve two problems:
If I wait with a NULL timer
(KeWaitForMutexObject(&List->Mutex,Executive,KernelMode,FALSE,NULL)) and
I’m at PASSIVE_LEVEL, all is fine.
If I’m at DISPATCH_LEVEL, I get a failed assertion at the call to
KeWaitForMutexObject().
I tried to test the IRQL and set the WaitTime at 0 if I’m at
DISPATCH_LEVEL and then KeWaitForMutexObject() works fine but I get an
exception with KeReleaseMutex() saying I doesn’t own the mutex.
Is there a better way of synchronizing accesses and which works at both
IRQL ?? Should I use a spin lock ?
Any help would be welcome!
You are currently subscribed to ntdev as: xxxxx@concord.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
the latest virus scan software available for the presence of computer
viruses.
**********************************************************************
Spinlock works, but make sure you’re not running a long list while holding the spinlock :-<>
If so, you need to change your list management a bit.
-----Original Message-----
From: Nicolas Mugnier [mailto:xxxxx@cesa.fr]
Sent: Thursday, February 13, 2003 9:43 AM
To: NT Developers Interest List
Subject: [ntdev] Synchronization at dispatch level
Hi,
I would like to synchronize access to a linked list. This list can be
accessed at DISPATCH_LEVEL and PASSIVE_LEVEL.
I’m using a Mutex, but I’ve two problems:
If I wait with a NULL timer
(KeWaitForMutexObject(&List->Mutex,Executive,KernelMode,FALSE,NULL)) and
I’m at PASSIVE_LEVEL, all is fine.
If I’m at DISPATCH_LEVEL, I get a failed assertion at the call to
KeWaitForMutexObject().
I tried to test the IRQL and set the WaitTime at 0 if I’m at
DISPATCH_LEVEL and then KeWaitForMutexObject() works fine but I get an
exception with KeReleaseMutex() saying I doesn’t own the mutex.
Is there a better way of synchronizing accesses and which works at both
IRQL ?? Should I use a spin lock ?
Any help would be welcome!
You are currently subscribed to ntdev as: xxxxx@interactivesi.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
As long as you are pushing and popping from either end, use
ExnterlockedInsertTail/HeadList and ExInterlockedRemoveTail/HeadList. These
functions require a spinlock and will sync across any IRQL. Remember, though
once used you must be consistent in using them, which means you cannot use
the unsync’d macro RemoveEntryList. Well … you could use
KeSynchronizeExecution.
–
Gary G. Little
Have Computer, will travel …
909-698-3191
909-551-2105
“Nicolas Mugnier” wrote in message
news:xxxxx@ntdev…
>
> Hi,
>
> I would like to synchronize access to a linked list. This list can be
> accessed at DISPATCH_LEVEL and PASSIVE_LEVEL.
> I’m using a Mutex, but I’ve two problems:
> If I wait with a NULL timer
> (KeWaitForMutexObject(&List->Mutex,Executive,KernelMode,FALSE,NULL)) and
> I’m at PASSIVE_LEVEL, all is fine.
> If I’m at DISPATCH_LEVEL, I get a failed assertion at the call to
> KeWaitForMutexObject().
> I tried to test the IRQL and set the WaitTime at 0 if I’m at
> DISPATCH_LEVEL and then KeWaitForMutexObject() works fine but I get an
> exception with KeReleaseMutex() saying I doesn’t own the mutex.
>
> Is there a better way of synchronizing accesses and which works at both
> IRQL ?? Should I use a spin lock ?
>
> Any help would be welcome!
>
>
>