mirror of
https://github.com/reactos/reactos.git
synced 2024-10-04 08:25:53 +00:00
[NTOSKRNL]
Implement IopAllocateIrpMustSucceed() which is designed to *normally* always return an IRP. Even in low memory situations (if you wait enough). svn path=/trunk/; revision=58243
This commit is contained in:
parent
a12df33047
commit
fc5c683b7b
|
@ -903,6 +903,12 @@ IopAbortInterruptedIrp(
|
|||
IN PIRP Irp
|
||||
);
|
||||
|
||||
PIRP
|
||||
NTAPI
|
||||
IopAllocateIrpMustSucceed(
|
||||
IN CCHAR StackSize
|
||||
);
|
||||
|
||||
//
|
||||
// Shutdown routines
|
||||
//
|
||||
|
|
|
@ -625,6 +625,40 @@ IoAllocateIrp(IN CCHAR StackSize,
|
|||
return Irp;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
PIRP
|
||||
NTAPI
|
||||
IopAllocateIrpMustSucceed(IN CCHAR StackSize)
|
||||
{
|
||||
LONG i;
|
||||
PIRP Irp;
|
||||
LARGE_INTEGER Sleep;
|
||||
|
||||
/* Try to get an IRP */
|
||||
Irp = IoAllocateIrp(StackSize, FALSE);
|
||||
if (Irp)
|
||||
return Irp;
|
||||
|
||||
/* If we fail, start looping till we may get one */
|
||||
i = LONG_MAX;
|
||||
do {
|
||||
i--;
|
||||
|
||||
/* First, sleep for 10ms */
|
||||
Sleep.QuadPart = -10 * 1000 * 10;;
|
||||
KeDelayExecutionThread(KernelMode, FALSE, &Sleep);
|
||||
|
||||
/* Then, retry allocation */
|
||||
Irp = IoAllocateIrp(StackSize, FALSE);
|
||||
if (Irp)
|
||||
return Irp;
|
||||
} while (i > 0);
|
||||
|
||||
return Irp;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue