mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:42:57 +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
2 changed files with 40 additions and 0 deletions
|
@ -903,6 +903,12 @@ IopAbortInterruptedIrp(
|
||||||
IN PIRP Irp
|
IN PIRP Irp
|
||||||
);
|
);
|
||||||
|
|
||||||
|
PIRP
|
||||||
|
NTAPI
|
||||||
|
IopAllocateIrpMustSucceed(
|
||||||
|
IN CCHAR StackSize
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Shutdown routines
|
// Shutdown routines
|
||||||
//
|
//
|
||||||
|
|
|
@ -625,6 +625,40 @@ IoAllocateIrp(IN CCHAR StackSize,
|
||||||
return Irp;
|
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
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue