mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
set thread WaitReason when blocking
initial work on I/O completion svn path=/trunk/; revision=4350
This commit is contained in:
parent
14597f5f11
commit
313dc5e53f
1 changed files with 35 additions and 4 deletions
|
@ -103,7 +103,8 @@ KiSideEffectsBeforeWake(DISPATCHER_HEADER * hdr,
|
|||
case InternalSynchronizationEvent:
|
||||
hdr->SignalState = 0;
|
||||
break;
|
||||
|
||||
|
||||
case InternalQueueType:
|
||||
case InternalSemaphoreType:
|
||||
hdr->SignalState--;
|
||||
break;
|
||||
|
@ -348,6 +349,7 @@ BOOLEAN KeDispatcherObjectWake(DISPATCHER_HEADER* hdr)
|
|||
case InternalSynchronizationTimer:
|
||||
return(KeDispatcherObjectWakeOne(hdr));
|
||||
|
||||
case InternalQueueType:
|
||||
case InternalSemaphoreType:
|
||||
DPRINT("hdr->SignalState %d\n", hdr->SignalState);
|
||||
if(hdr->SignalState>0)
|
||||
|
@ -587,8 +589,18 @@ KeWaitForMultipleObjects(ULONG Count,
|
|||
blk->NextWaitBlock = blk + 1;
|
||||
}
|
||||
|
||||
//add wait block to disp. obj. wait list
|
||||
InsertTailList(&hdr->WaitListHead, &blk->WaitListEntry);
|
||||
/*
|
||||
* add wait block to disp. obj. wait list
|
||||
* Use FIFO for all waits except for queues which use LIFO
|
||||
*/
|
||||
if (WaitReason == WrQueue)
|
||||
{
|
||||
InsertHeadList(&hdr->WaitListHead, &blk->WaitListEntry);
|
||||
}
|
||||
else
|
||||
{
|
||||
InsertTailList(&hdr->WaitListHead, &blk->WaitListEntry);
|
||||
}
|
||||
|
||||
blk = blk->NextWaitBlock;
|
||||
}
|
||||
|
@ -605,7 +617,26 @@ KeWaitForMultipleObjects(ULONG Count,
|
|||
&CurrentThread->WaitBlock[3].WaitListEntry);
|
||||
}
|
||||
|
||||
PsBlockThread(&Status, Alertable, WaitMode, TRUE, WaitIrql);
|
||||
//io completion
|
||||
if (CurrentThread->Queue)
|
||||
{
|
||||
CurrentThread->Queue->RunningThreads--;
|
||||
if (WaitReason != WrQueue && CurrentThread->Queue->RunningThreads < CurrentThread->Queue->MaximumThreads &&
|
||||
!IsListEmpty(&CurrentThread->Queue->EntryListHead))
|
||||
{
|
||||
KeDispatcherObjectWake(&CurrentThread->Queue->Header);
|
||||
}
|
||||
}
|
||||
|
||||
PsBlockThread(&Status, Alertable, WaitMode, TRUE, WaitIrql, WaitReason);
|
||||
|
||||
//io completion
|
||||
if (CurrentThread->Queue)
|
||||
{
|
||||
CurrentThread->Queue->RunningThreads++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
while (Status == STATUS_KERNEL_APC);
|
||||
|
||||
|
|
Loading…
Reference in a new issue