ERESOURCE equiv to KeReadStateEvent?

Does anyone know of an API that will give me information on whether an
ERESOURCE is actually acquired or not w/o actually trying to acquire it?
Basically, I’m looking for the equivalent of KeReadStateEvent, but for
ERESOURCES. “ExIsResourceAcquiredLite” and friends seem to just give
information on whether the current thread has it acquired, not whether it is
acquired by other threads…

TIA,
Matt

Matt,

I’m trying to envision what one could use such an interface for, given
that the answer you might get back will be potentially invalid when you
actually test it.

In other words, suppose that this API exists and you try to use it:

IsLockAcquired = ExCheckIfResourceIsAcquired(lock);

If (IsLockAcquired) { … }

Of course, nothing prevents the state of the lock from changing between
the assignment and the test - you might have been descheduled, many
other threads might have run, and then you reacquired the CPU. It is
hard for me to envision logic that makes too much sense here.

KeReadStateEvent is only useful for notification events, not
synchronization events, and you still have to be aware that the system
state might change between the poll and the actual test of the event
state.

So, to answer your question: no, there is no equivalent.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Matthew N. White
Sent: Friday, February 13, 2004 3:48 PM
To: ntfsd redirect
Subject: [ntfsd] ERESOURCE equiv to KeReadStateEvent?

Does anyone know of an API that will give me information on whether an
ERESOURCE is actually acquired or not w/o actually trying to acquire it?
Basically, I’m looking for the equivalent of KeReadStateEvent, but for
ERESOURCES. “ExIsResourceAcquiredLite” and friends seem to just give
information on whether the current thread has it acquired, not whether
it is acquired by other threads…

TIA,
Matt


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@osr.com To unsubscribe
send a blank email to xxxxx@lists.osr.com

The APIs are

ExIsResourceAcquiredExclusiveLite
ExIsResourceAcquiredSharedLite

You can recognize the state from the ERESOURCE members
(e.g. if you are debugging in a moment)

if(Resource->ActiveCount > 0)
// Resource is acquired

if(Resource->Flags & 0x80)
// Resource is acquired exclusively

The thread which has the resource acquired is
stored in the Resource->OwnerThreads[0]
(if acquired exclusive) or Resource->OwnerThreads[1]
(if acquired shared).

L.

Thanks guys. Yes, I do realize that it could change between testing the
condition and doing something with the information. The situation is too
complicated to explain here :wink:

Matt

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ladislav Zezula
Sent: Monday, February 16, 2004 1:45 AM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] ERESOURCE equiv to KeReadStateEvent?

The APIs are

ExIsResourceAcquiredExclusiveLite
ExIsResourceAcquiredSharedLite

You can recognize the state from the ERESOURCE members (e.g. if you are
debugging in a moment)

if(Resource->ActiveCount > 0)
// Resource is acquired

if(Resource->Flags & 0x80)
// Resource is acquired exclusively

The thread which has the resource acquired is stored in the
Resource->OwnerThreads[0] (if acquired exclusive) or
Resource->OwnerThreads[1] (if acquired shared).

L.


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@bitarmor.com To unsubscribe
send a blank email to xxxxx@lists.osr.com