mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Working and tested KeWaitForXXX
svn path=/trunk/; revision=884
This commit is contained in:
parent
81547d8842
commit
6b53b3acea
1 changed files with 8 additions and 15 deletions
|
@ -168,13 +168,12 @@ static BOOLEAN KeDispatcherObjectWakeAll(DISPATCHER_HEADER* hdr)
|
||||||
current = CONTAINING_RECORD(current_entry,KWAIT_BLOCK,
|
current = CONTAINING_RECORD(current_entry,KWAIT_BLOCK,
|
||||||
WaitListEntry);
|
WaitListEntry);
|
||||||
DPRINT("Waking %x\n",current->Thread);
|
DPRINT("Waking %x\n",current->Thread);
|
||||||
|
|
||||||
if (current->WaitType == WaitAny)
|
if (current->WaitType == WaitAny)
|
||||||
{
|
{
|
||||||
DPRINT("WaitAny: Remove all wait blocks.\n");
|
DPRINT("WaitAny: Remove all wait blocks.\n");
|
||||||
for( PrevBlock = current->Thread->WaitBlockList; PrevBlock; PrevBlock = PrevBlock->NextWaitBlock )
|
for( PrevBlock = current->Thread->WaitBlockList; PrevBlock; PrevBlock = PrevBlock->NextWaitBlock )
|
||||||
if( PrevBlock != current )
|
if( PrevBlock != current )
|
||||||
RemoveEntryList( &PrevBlock->WaitListEntry );
|
RemoveEntryList( &(PrevBlock->WaitListEntry) );
|
||||||
current->Thread->WaitBlockList = 0;
|
current->Thread->WaitBlockList = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -200,11 +199,11 @@ static BOOLEAN KeDispatcherObjectWakeAll(DISPATCHER_HEADER* hdr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KiSideEffectsBeforeWake(hdr);
|
KiSideEffectsBeforeWake(hdr);
|
||||||
Status = current->WaitKey;
|
Status = current->WaitKey;
|
||||||
PsUnfreezeThread( CONTAINING_RECORD( current->Thread,ETHREAD,Tcb ), &Status );
|
if( current->Thread->WaitBlockList == NULL )
|
||||||
};
|
PsUnfreezeThread( CONTAINING_RECORD( current->Thread,ETHREAD,Tcb ), &Status );
|
||||||
|
}
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,13 +226,12 @@ static BOOLEAN KeDispatcherObjectWakeOne(DISPATCHER_HEADER* hdr)
|
||||||
WaitListEntry);
|
WaitListEntry);
|
||||||
DPRINT("current_entry %x current %x\n",current_entry,current);
|
DPRINT("current_entry %x current %x\n",current_entry,current);
|
||||||
|
|
||||||
|
|
||||||
if (current->WaitType == WaitAny)
|
if (current->WaitType == WaitAny)
|
||||||
{
|
{
|
||||||
DPRINT("WaitAny: Remove all wait blocks.\n");
|
DPRINT("WaitAny: Remove all wait blocks.\n");
|
||||||
for( PrevBlock = current->Thread->WaitBlockList; PrevBlock; PrevBlock = PrevBlock->NextWaitBlock )
|
for( PrevBlock = current->Thread->WaitBlockList; PrevBlock; PrevBlock = PrevBlock->NextWaitBlock )
|
||||||
if( PrevBlock != current )
|
if( PrevBlock != current )
|
||||||
RemoveEntryList( &PrevBlock->WaitListEntry );
|
RemoveEntryList( &(PrevBlock->WaitListEntry) );
|
||||||
current->Thread->WaitBlockList = 0;
|
current->Thread->WaitBlockList = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -261,7 +259,6 @@ static BOOLEAN KeDispatcherObjectWakeOne(DISPATCHER_HEADER* hdr)
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("Waking %x\n",current->Thread);
|
DPRINT("Waking %x\n",current->Thread);
|
||||||
|
|
||||||
KiSideEffectsBeforeWake(hdr);
|
KiSideEffectsBeforeWake(hdr);
|
||||||
Status = current->WaitKey;
|
Status = current->WaitKey;
|
||||||
PsUnfreezeThread( CONTAINING_RECORD( current->Thread, ETHREAD, Tcb ), &Status );
|
PsUnfreezeThread( CONTAINING_RECORD( current->Thread, ETHREAD, Tcb ), &Status );
|
||||||
|
@ -396,7 +393,6 @@ NTSTATUS KeWaitForSingleObject(PVOID Object,
|
||||||
(UCHAR)Alertable,
|
(UCHAR)Alertable,
|
||||||
WaitMode);
|
WaitMode);
|
||||||
DPRINT("Woke from wait\n");
|
DPRINT("Woke from wait\n");
|
||||||
|
|
||||||
} while (Status == STATUS_KERNEL_APC);
|
} while (Status == STATUS_KERNEL_APC);
|
||||||
|
|
||||||
if (Timeout != NULL)
|
if (Timeout != NULL)
|
||||||
|
@ -433,13 +429,13 @@ NTSTATUS KeWaitForMultipleObjects(ULONG Count,
|
||||||
|
|
||||||
if (WaitBlockArray == NULL)
|
if (WaitBlockArray == NULL)
|
||||||
{
|
{
|
||||||
if (Count > 3)
|
if (Count > 4)
|
||||||
{
|
{
|
||||||
DbgPrint("(%s:%d) Too many objects!\n",
|
DbgPrint("(%s:%d) Too many objects!\n",
|
||||||
__FILE__,__LINE__);
|
__FILE__,__LINE__);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
blk = &CurrentThread->WaitBlock[1];
|
blk = &CurrentThread->WaitBlock[0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -501,10 +497,9 @@ NTSTATUS KeWaitForMultipleObjects(ULONG Count,
|
||||||
if (i == Count - 1)
|
if (i == Count - 1)
|
||||||
blk->NextWaitBlock = NULL;
|
blk->NextWaitBlock = NULL;
|
||||||
else
|
else
|
||||||
blk->NextWaitBlock = (PVOID)((ULONG)blk+sizeof(KWAIT_BLOCK));
|
blk->NextWaitBlock = blk + 1;
|
||||||
DPRINT("blk %p blk->NextWaitBlock %p\n",
|
DPRINT("blk %p blk->NextWaitBlock %p\n",
|
||||||
blk, blk->NextWaitBlock);
|
blk, blk->NextWaitBlock);
|
||||||
|
|
||||||
InsertTailList(&(hdr->WaitListHead),&(blk->WaitListEntry));
|
InsertTailList(&(hdr->WaitListHead),&(blk->WaitListEntry));
|
||||||
// DPRINT("hdr->WaitListHead.Flink %x hdr->WaitListHead.Blink %x\n",
|
// DPRINT("hdr->WaitListHead.Flink %x hdr->WaitListHead.Blink %x\n",
|
||||||
// hdr->WaitListHead.Flink,hdr->WaitListHead.Blink);
|
// hdr->WaitListHead.Flink,hdr->WaitListHead.Blink);
|
||||||
|
@ -618,8 +613,6 @@ NTSTATUS STDCALL NtWaitForSingleObject (IN HANDLE Object,
|
||||||
|
|
||||||
ObDereferenceObject(ObjectPtr);
|
ObDereferenceObject(ObjectPtr);
|
||||||
|
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue