hbirr(a)svn.reactos.org wrote:
if (!Resource->ActiveCount)
{
- /* Nobody owns it, so let's take control */
+ if (Resource->NumberOfSharedWaiters == 0)
+ {
+ Owner = &Resource->OwnerThreads[1];
+ }
+ else
+ {
+ /* Find a free entry */
+ Owner = ExpFindFreeEntry(Resource, &OldIrql);
+ if (!Owner) goto TryAcquire;
+ }
+
+ Owner->OwnerThread = Thread;
+ Owner->OwnerCount = 1;
Resource->ActiveCount = 1;
- Resource->OwnerThreads[1].OwnerThread = Thread;
- Resource->OwnerThreads[1].OwnerCount = 1;
/* Release the lock and return */
ExReleaseResourceLock(&Resource->SpinLock, OldIrql);
This change makes no sense. Note that we check for
!Resource->ActiveCount. This, by definition implies that there CANNOT be
any exclusive owner or shared owner. Access to the resource should be
granted instanteously.
Best regards,
Alex Ionescu