mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 06:43:01 +00:00
Fix a race condition in quantum code. Spotted by Shmuel Baron.
svn path=/trunk/; revision=16904
This commit is contained in:
parent
46be8912e3
commit
34674d7646
1 changed files with 10 additions and 2 deletions
|
@ -305,14 +305,22 @@ KeUpdateRunTime(
|
||||||
|
|
||||||
/* FIXME: Do DPC rate adjustments */
|
/* FIXME: Do DPC rate adjustments */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* RACE CONDITION WARNING. If one stays at DISPATCH_LEVEL for a long
|
||||||
|
* time the DPC routine which checks for quantum end will not be executed
|
||||||
|
* and decrementing the quantum here would result in overflow.
|
||||||
|
*/
|
||||||
|
if (CurrentThread->Quantum < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we're at end of quantum request software interrupt. The rest
|
* If we're at end of quantum request software interrupt. The rest
|
||||||
* is handled in KiDispatchInterrupt.
|
* is handled in KiDispatchInterrupt.
|
||||||
*/
|
*/
|
||||||
if ((CurrentThread->Quantum -= 3) <= 0)
|
if ((CurrentThread->Quantum -= 3) <= 0)
|
||||||
{
|
{
|
||||||
Prcb->QuantumEnd = TRUE;
|
Prcb->QuantumEnd = TRUE;
|
||||||
HalRequestSoftwareInterrupt(DISPATCH_LEVEL);
|
HalRequestSoftwareInterrupt(DISPATCH_LEVEL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue