Should I use KeWaitForSingleObject?

Hi All,
I am thinking over weather it is a good idea to use KeWaitForSingleObject? Here is my basic flow:

  1. Application request me to fire a DMA request to hardware, at PASSIVE level.
  2. The hardware completes the request and calls my ISR.
  3. My ISR invokes DPC.

Now in step 1, I could use KeWaitForSingleObject and then signal the event from my DPC or I could queue a request in WDF manual queue , retrun status PENDING and then during completion from DPC, get the request and complete it.

Can someone please comment which approach is better?

Thanks,
– Ajitabh

“Ajitabh Saxena” wrote in message
news:xxxxx@ntdev…
> Hi All,
> I am thinking over weather it is a good idea to use
> KeWaitForSingleObject? Here is my basic flow:
>
> 1. Application request me to fire a DMA request to hardware, at PASSIVE
> level.
> 2. The hardware completes the request and calls my ISR.
> 3. My ISR invokes DPC.
>
> Now in step 1, I could use KeWaitForSingleObject and then signal the event
> from my DPC or I could queue a request in WDF manual queue , retrun
> status PENDING and then during completion from DPC, get the request and
> complete it.
>
> Can someone please comment which approach is better?

The latter. You don’t want to wait in the request handler.

– pa

In the DPC or higher,you can’t use Kewaitforsingleobject.

Everyone knows that…read my question.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of havegone@163.com
Sent: Thursday, April 09, 2009 6:03 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Should I use KeWaitForSingleObject?

In the DPC or higher,you can’t use Kewaitforsingleobject.


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

The latter, it is asynchronous request processing.

Regards
Haibo
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ajitabh Saxena
Sent: Thursday, April 09, 2009 8:36 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Should I use KeWaitForSingleObject?

Hi All,
I am thinking over weather it is a good idea to use
KeWaitForSingleObject? Here is my basic flow:

  1. Application request me to fire a DMA request to hardware, at PASSIVE
    level.
  2. The hardware completes the request and calls my ISR.
  3. My ISR invokes DPC.

Now in step 1, I could use KeWaitForSingleObject and then signal the event
from my DPC or I could queue a request in WDF manual queue , retrun status
PENDING and then during completion from DPC, get the request and complete
it.

Can someone please comment which approach is better?

Thanks,
– Ajitabh


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

At the risk of committing heresy, if your application is synchronous
then there is not a lot of difference between the two approaches. The
NT way is of course to queue an IRP and complete that IRP in the dpc
routine.

Mark Roddy

On Wed, Apr 8, 2009 at 8:35 PM, Ajitabh Saxena wrote:
> Hi All,
> ? ? I am thinking over weather it is a good idea to use KeWaitForSingleObject? Here is my basic flow:
>
> 1. Application request me to fire a DMA request to hardware, at PASSIVE level.
> 2. The hardware completes the request and calls my ISR.
> 3. My ISR invokes DPC.
>
> Now in step 1, I could use KeWaitForSingleObject and then signal the event from my DPC or I could queue a request in ?WDF manual queue , retrun status PENDING and then during completion from DPC, get the request and complete it.
>
> Can someone please comment which approach is better?
>
> Thanks,
> – Ajitabh
>
> —
> 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
>

>Can someone please comment which approach is better?

Queuing is better and is nearly a must, since otherwise the calling thread will be blocked in the dispatch routine and the app will not be able to have the benefits of overlapped IO.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com