Author: mnordell Date: Wed Oct 3 17:57:14 2012 New Revision: 57465
URL: http://svn.reactos.org/svn/reactos?rev=57465&view=rev Log: [NTOSKERNEL] Refactoring KiSatisfyObjectWait macro to prevent code duplication.
Modified: trunk/reactos/ntoskrnl/include/internal/ke_x.h
Modified: trunk/reactos/ntoskrnl/include/internal/ke_x.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/k... ============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ke_x.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/ke_x.h [iso-8859-1] Wed Oct 3 17:57:14 2012 @@ -683,55 +683,6 @@ ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL); KeReleaseInStackQueuedSpinLockFromDpcLevel(DeviceLock); } -} - -// -// Satisfies the wait of any dispatcher object -// -#define KiSatisfyObjectWait(Object, Thread) \ -{ \ - /* Special case for Mutants */ \ - if ((Object)->Header.Type == MutantObject) \ - { \ - /* Decrease the Signal State */ \ - (Object)->Header.SignalState--; \ - \ - /* Check if it's now non-signaled */ \ - if (!(Object)->Header.SignalState) \ - { \ - /* Set the Owner Thread */ \ - (Object)->OwnerThread = Thread; \ - \ - /* Disable APCs if needed */ \ - Thread->KernelApcDisable = Thread->KernelApcDisable - \ - (Object)->ApcDisable; \ - \ - /* Check if it's abandoned */ \ - if ((Object)->Abandoned) \ - { \ - /* Unabandon it */ \ - (Object)->Abandoned = FALSE; \ - \ - /* Return Status */ \ - Thread->WaitStatus = STATUS_ABANDONED; \ - } \ - \ - /* Insert it into the Mutant List */ \ - InsertHeadList(Thread->MutantListHead.Blink, \ - &(Object)->MutantListEntry); \ - } \ - } \ - else if (((Object)->Header.Type & TIMER_OR_EVENT_TYPE) == \ - EventSynchronizationObject) \ - { \ - /* Synchronization Timers and Events just get un-signaled */ \ - (Object)->Header.SignalState = 0; \ - } \ - else if ((Object)->Header.Type == SemaphoreObject) \ - { \ - /* These ones can have multiple states, so we only decrease it */ \ - (Object)->Header.SignalState--; \ - } \ }
// @@ -787,6 +738,22 @@ }
// +// Satisfies the wait of any dispatcher object +// +#define KiSatisfyObjectWait(Object, Thread) \ +{ \ + /* Special case for Mutants */ \ + if ((Object)->Header.Type == MutantObject) \ + { \ + KiSatisfyMutantWait((Object), (Thread)); \ + } \ + else \ + { \ + KiSatisfyNonMutantWait(Object); \ + } \ +} + +// // Recalculates the due time // FORCEINLINE