I don't understand ExAcquireResourceExclusiveLite

Hello,

I have a simple question about “ExAcquireResourceExclusiveLite”.
I have the following code (that of course makes no sense and is for testing
only):

//------------------------------

BOOLEAN b;

b = ExAcquireResourceExclusiveLite( &Resource, FALSE );
b = ExAcquireResourceExclusiveLite( &Resource, FALSE );
.
.
.
if (b) ExReleaseResourceLite(&Resource);
.
.
.

//------------------------------

Two calls of “ExAcquireResourceExclusiveLite” and both return always
“TRUE”!!! Shouldn’t the second call return “FALSE” ???

Besides: When I try to use “ExTryToAcquireResourceExclusiveLite” the Linker
can’t find it!!!

Thanks in advance!
Frank Friemel

1.ExTryToAcquireResourceExclusiveLite doesn’t exist - NTIFS.H contains
prototype of non-exising routine.
But ExAcquireResourceExclusiveLite(…, FALSE) does requested
functionality.

  1. Resources can be acquired recursively. But for every acquire there must
    be corresponding release.
    If the resource is already acquired exclusively for some thread - every
    next acquire shared/exclsuive
    will be done successfully withou waiting - and exclusive access will be
    granted.

WARNING:
Trying to acquire resource exclusive (Wait=TRUE) in context of some
thread where corresponding resource
ia already acquired shared is programmer’s error.

Paul

-----P?vodn? zpr?va-----
Od: Frank Friemel [SMTP:xxxxx@gdata.de]
Odesl?no: 27. dubna 2000 12:43
Komu: File Systems Developers
P?edm?t: [ntfsd] I don’t understand ExAcquireResourceExclusiveLite

Hello,

I have a simple question about “ExAcquireResourceExclusiveLite”.
I have the following code (that of course makes no sense and is for
testing
only):

//------------------------------

BOOLEAN b;

b = ExAcquireResourceExclusiveLite( &Resource, FALSE );
b = ExAcquireResourceExclusiveLite( &Resource, FALSE );
.
.
.
if (b) ExReleaseResourceLite(&Resource);
.
.
.

//------------------------------

Two calls of “ExAcquireResourceExclusiveLite” and both return always
“TRUE”!!! Shouldn’t the second call return “FALSE” ???

Besides: When I try to use “ExTryToAcquireResourceExclusiveLite” the
Linker
can’t find it!!!

Thanks in advance!
Frank Friemel


You are currently subscribed to ntfsd as: xxxxx@sodatsw.cz
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

From what I understand of ERESOURCE is that it has the concept of “owning
thread”. That means that a resources is acquired (or owned) by a thread. If
a thread has acquired a ERESOURCE exclusively, and tries to acquire it again
(exclusive OR shared), it will still have exclusive access.

On the other hand, if *another* thread tries to acquire the resource, it
will be failed, or put to wait state (depending on Wait parameter).

In your code it looks like the same thread is trying to acquire the resource
again, and hence succeeds.

If you note, that is where ExReleaseResourceForThreadLite() comes from, and
not just ExReleaseResource().

Also, you must release them as many times as you acquired them.

Hope that helps.
Shweta.

Hello,

I have a simple question about “ExAcquireResourceExclusiveLite”.
I have the following code (that of course makes no sense and is for testing
only):

file://------------------------------

BOOLEAN b;

b = ExAcquireResourceExclusiveLite( &Resource, FALSE );
b = ExAcquireResourceExclusiveLite( &Resource, FALSE );
.
.
.
if (b) ExReleaseResourceLite(&Resource);
.
.
.

file://------------------------------

Two calls of “ExAcquireResourceExclusiveLite” and both return always
“TRUE”!!! Shouldn’t the second call return “FALSE” ???

Besides: When I try to use “ExTryToAcquireResourceExclusiveLite” the Linker
can’t find it!!!

Thanks in advance!
Frank Friemel


You are currently subscribed to ntfsd as: xxxxx@techie.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)


FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup