revert my changes

svn path=/trunk/; revision=14275
This commit is contained in:
Thomas Bluemel
2005-03-23 13:26:38 +00:00
parent 58042e8e21
commit 8e6267fd39
+30 -22
View File
@@ -250,7 +250,7 @@ KeWaitForSingleObject(PVOID Object,
/* It has a normal signal state, so unwait it and return */
KiSatisfyObjectWait(CurrentObject, CurrentThread);
Status = STATUS_WAIT_0;
break;
goto WaitDone;
} else {
@@ -285,7 +285,7 @@ KeWaitForSingleObject(PVOID Object,
/* Return a timeout */
Status = STATUS_TIMEOUT;
break;
goto WaitDone;
}
/* Point to Timer Wait Block and Thread Timer */
@@ -311,7 +311,7 @@ KeWaitForSingleObject(PVOID Object,
/* Return a timeout if we couldn't insert the timer for some reason */
Status = STATUS_TIMEOUT;
break;
goto WaitDone;
}
}
@@ -344,6 +344,7 @@ KeWaitForSingleObject(PVOID Object,
} while (TRUE);
WaitDone:
/* Release the Lock, we are done */
DPRINT("Returning from KeWaitForMultipleObjects(), %x. Status: %d\n", KeGetCurrentThread(), Status);
KeReleaseDispatcherDatabaseLock(CurrentThread->WaitIrql);
@@ -368,7 +369,7 @@ KeWaitForMultipleObjects(ULONG Count,
PKWAIT_BLOCK TimerWaitBlock;
PKTIMER ThreadTimer;
PKTHREAD CurrentThread = KeGetCurrentThread();
BOOLEAN AllObjectsSignaled;
ULONG AllObjectsSignaled;
ULONG WaitIndex;
NTSTATUS Status;
NTSTATUS WaitStatus;
@@ -506,7 +507,7 @@ KeWaitForMultipleObjects(ULONG Count,
/* Satisfy their Waits and return to the caller */
KiSatisifyMultipleObjectWaits(WaitBlock);
Status = STATUS_WAIT_0;
break;
goto WaitDone;
}
/* Make sure we can satisfy the Alertable request */
@@ -523,7 +524,7 @@ KeWaitForMultipleObjects(ULONG Count,
/* Return a timeout */
Status = STATUS_TIMEOUT;
break;
goto WaitDone;
}
/* Point to Timer Wait Block and Thread Timer */
@@ -548,20 +549,22 @@ KeWaitForMultipleObjects(ULONG Count,
/* Return a timeout if we couldn't insert the timer for some reason */
Status = STATUS_TIMEOUT;
break;
goto WaitDone;
}
}
/* Insert into Object's Wait List*/
for (WaitBlock = CurrentThread->WaitBlockList;
WaitBlock != NULL;
WaitBlock = WaitBlock->NextWaitBlock) {
WaitBlock = CurrentThread->WaitBlockList;
while (WaitBlock) {
/* Get the Current Object */
CurrentObject = WaitBlock->Object;
/* Link the Object to this Wait Block */
InsertTailList(&CurrentObject->WaitListHead, &WaitBlock->WaitListEntry);
/* Move to the next Wait Block */
WaitBlock = WaitBlock->NextWaitBlock;
}
/* Handle Kernel Queues */
@@ -657,10 +660,8 @@ KiWaitTest(PDISPATCHER_HEADER Object,
/* Loop the Wait Entries */
DPRINT("KiWaitTest for Object: %x\n", Object);
WaitList = &Object->WaitListHead;
for (WaitEntry = WaitList->Flink;
(WaitEntry != WaitList) && (Object->SignalState > 0);
WaitEntry = WaitEntry->Flink) {
WaitEntry = WaitList->Flink;
while ((WaitEntry != WaitList) && (Object->SignalState > 0)) {
/* Get the current wait block */
CurrentWaitBlock = CONTAINING_RECORD(WaitEntry, KWAIT_BLOCK, WaitListEntry);
@@ -677,19 +678,21 @@ KiWaitTest(PDISPATCHER_HEADER Object,
/* Everything must be satisfied */
DPRINT("Checking for a Wait All\n");
NextWaitBlock = CurrentWaitBlock->NextWaitBlock;
/* Loop first to make sure they are valid */
for (NextWaitBlock = CurrentWaitBlock->NextWaitBlock;
NextWaitBlock != NULL;
NextWaitBlock = NextWaitBlock->NextWaitBlock) {
while (NextWaitBlock) {
/* Check if the object is signaled */
if (!KiIsObjectSignaled(Object, CurrentWaitBlock->Thread)) {
/* It's not, move to the next one */
DPRINT1("One of the object is non-signaled, sorry.\n");
continue;
goto SkipUnwait;
}
/* Go to the next Wait block */
NextWaitBlock = NextWaitBlock->NextWaitBlock;
}
/* All the objects are signaled, we can satisfy */
@@ -701,6 +704,10 @@ KiWaitTest(PDISPATCHER_HEADER Object,
/* All waits satisfied, unwait the thread */
DPRINT("Unwaiting the Thread\n");
KiAbortWaitThread(CurrentWaitBlock->Thread, CurrentWaitBlock->WaitKey, Increment);
SkipUnwait:
/* Next entry */
WaitEntry = WaitEntry->Flink;
}
DPRINT("Done\n");
@@ -721,14 +728,15 @@ KiAbortWaitThread(PKTHREAD Thread,
/* Remove the Wait Blocks from the list */
DPRINT("Removing waits\n");
for (WaitBlock = Thread->WaitBlockList;
WaitBlock != NULL;
WaitBlock = WaitBlock->NextWaitBlock) {
WaitBlock = Thread->WaitBlockList;
while (WaitBlock) {
/* Remove it */
DPRINT("Removing Waitblock: %x, %x\n", WaitBlock, WaitBlock->NextWaitBlock);
RemoveEntryList(&WaitBlock->WaitListEntry);
/* Go to the next one */
WaitBlock = WaitBlock->NextWaitBlock;
};
/* Check if there's a Thread Timer */