Resource Acquire/Release

I acquire resource with ExAcquireResourceSharedLite. At some point I need
exclusive access to the resource so I call ExAcquireResourceExclusiveLite on
the same object. As far as I understand this will convert access to
exclusive. What bothers me is do I have to call ExReleaseResourceLite twice
after that?

for every acquire you must have a release.

BTW, you have to be careful. If you have it shared, you cannot get it
exclusive. There are conversion routines where you can convert the lock,
but I can’t remember off the top of my head if it is coverting shared to
exclusive or exclusive to shared.

–Mark


Mark Cariddi
Open Systems Resources, Inc.
www.osr.com

“Alexey Logachyov” wrote in message news:xxxxx@ntdev…
>
> I acquire resource with ExAcquireResourceSharedLite. At some point I need
> exclusive access to the resource so I call ExAcquireResourceExclusiveLite
on
> the same object. As far as I understand this will convert access to
> exclusive. What bothers me is do I have to call ExReleaseResourceLite
twice
> after that?
>
>
>
>

> I acquire resource with ExAcquireResourceSharedLite. At some point I
need

exclusive access to the resource so I call
ExAcquireResourceExclusiveLite on
the same object. As far as I understand this will convert access to
exclusive. What bothers me is do I have to call
ExReleaseResourceLite twice
after that?

IIRC yes, you must release twice.

Max

> but I can’t remember off the top of my head if it is coverting
shared to

exclusive or exclusive to shared.

Exclusive to shared only.

Max

If you acquire a resource shared and in the same thread you acquire it again
exclusive that will cause your thread to deadlock. You cannot convert shared
to exclusive.

The otherway around is possible. You can acquire exclusive and then if you
acquire shared you will be granted recursive exclusive access. This is
documented in the DDK


This posting is provided “AS IS” with no warranties, and confers no rights.
“Alexey Logachyov” wrote in message news:xxxxx@ntdev…
>
> I acquire resource with ExAcquireResourceSharedLite. At some point I need
> exclusive access to the resource so I call ExAcquireResourceExclusiveLite
on
> the same object. As far as I understand this will convert access to
> exclusive. What bothers me is do I have to call ExReleaseResourceLite
twice
> after that?
>
>
>
>