Infinite For Loop (revised)

Hi, I want alter my last request to include a few more
details.

As I mentioned earlier I have large set of rescources
say in the range of 20,000.

A Request to my driver has to access any one of these
resources.

I have RTL_BITMAP, representing the usage of these
resources. My Algorithm should go something like this.

  1. Acquire a Spin Lock for the bitmap

  2. Find the first free bit and set it indicating the
    acquiring of that resource. Easy enough, I use
    RTLFindClearBitsAndSet.

  3. Release the SpinLock holding the bitmap

  4. If there was no free bit available, I have to wait
    until there is. Can I do something as primitive as an
    infinite loop. Or is there a more elegant method?

Rajeev


Everything you always wanted to know about cars and bikes,now
at: http://in.autos.yahoo.com/cricket/tracker.html

No, a simple loop would generally not be the right answer here.

Generally the original request (which I assume is in the form of an
IRP,) is simply queued, (on a list of resource request wiaters,) marked
pending, and STATUS_PENDING is returned from the dispatch routine in
your driver. When (at least one of,) your managed resources are freed,
code in your driver runs the list of queued resource waiters, attempting
to assign resources to requests. As a resource is assigned, the
associated IRP is completed, and the originating thread is informed that
the resource has now been assigned.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rajeev Rao
Sent: Tuesday, May 28, 2002 3:43 AM
To: NT Developers Interest List
Subject: [ntdev] Infinite For Loop (revised)

Hi, I want alter my last request to include a few more
details.

As I mentioned earlier I have large set of rescources
say in the range of 20,000.

A Request to my driver has to access any one of these resources.

I have RTL_BITMAP, representing the usage of these
resources. My Algorithm should go something like this.

  1. Acquire a Spin Lock for the bitmap

  2. Find the first free bit and set it indicating the
    acquiring of that resource. Easy enough, I use
    RTLFindClearBitsAndSet.

  3. Release the SpinLock holding the bitmap

  4. If there was no free bit available, I have to wait
    until there is. Can I do something as primitive as an
    infinite loop. Or is there a more elegant method?

Rajeev



Everything you always wanted to know about cars and bikes,now
at: http://in.autos.yahoo.com/cricket/tracker.html


You are currently subscribed to ntdev as:
xxxxx@hollistech.com To unsubscribe send a blank email to
%%email.unsub%%