[ros-dev] Re: [ros-diffs] [hbirr] 20793: - We cannot access the OwnerTable without locking the resource.

Alex Ionescu ionucu at videotron.ca
Thu Jan 12 01:20:29 CET 2006


hbirr at 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


More information about the Ros-dev mailing list