mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 13:10:39 +00:00
- Fix worker thread priorities. A quick check of the DDK and ProcesXP confirmed that there was a bug (thanks GvG!). Turns out I had forgotten to use the -base- priority kernel call. Renamed some variables to make it clearer and fixed the bug. The correct priorities are 12, 13, 15.
svn path=/trunk/; revision=20561
This commit is contained in:
parent
450dfac672
commit
d97db4ba3a
2 changed files with 15 additions and 18 deletions
|
@ -19,17 +19,17 @@
|
||||||
/* DATA **********************************************************************/
|
/* DATA **********************************************************************/
|
||||||
|
|
||||||
/* Number of worker threads for each Queue */
|
/* Number of worker threads for each Queue */
|
||||||
#define EX_HYPERCRITICAL_WORK_THREADS 1
|
#define EX_HYPERCRITICAL_WORK_THREADS 1
|
||||||
#define EX_DELAYED_WORK_THREADS 3
|
#define EX_DELAYED_WORK_THREADS 3
|
||||||
#define EX_CRITICAL_WORK_THREADS 5
|
#define EX_CRITICAL_WORK_THREADS 5
|
||||||
|
|
||||||
/* Magic flag for dynamic worker threads */
|
/* Magic flag for dynamic worker threads */
|
||||||
#define EX_DYNAMIC_WORK_THREAD 0x80000000
|
#define EX_DYNAMIC_WORK_THREAD 0x80000000
|
||||||
|
|
||||||
/* Worker thread priorities */
|
/* Worker thread priority increments (added to base priority) */
|
||||||
#define EX_HYPERCRITICAL_QUEUE_PRIORITY 7
|
#define EX_HYPERCRITICAL_QUEUE_PRIORITY_INCREMENT 7
|
||||||
#define EX_CRITICAL_QUEUE_PRIORITY 5
|
#define EX_CRITICAL_QUEUE_PRIORITY_INCREMENT 5
|
||||||
#define EX_DELAYED_QUEUE_PRIORITY 4
|
#define EX_DELAYED_QUEUE_PRIORITY_INCREMENT 4
|
||||||
|
|
||||||
/* The actual worker queue array */
|
/* The actual worker queue array */
|
||||||
EX_WORK_QUEUE ExWorkerQueue[MaximumWorkQueue];
|
EX_WORK_QUEUE ExWorkerQueue[MaximumWorkQueue];
|
||||||
|
@ -284,17 +284,17 @@ ExpCreateWorkerThread(WORK_QUEUE_TYPE WorkQueueType,
|
||||||
if (WorkQueueType == DelayedWorkQueue)
|
if (WorkQueueType == DelayedWorkQueue)
|
||||||
{
|
{
|
||||||
/* Priority == 4 */
|
/* Priority == 4 */
|
||||||
Priority = EX_DELAYED_QUEUE_PRIORITY;
|
Priority = EX_DELAYED_QUEUE_PRIORITY_INCREMENT;
|
||||||
}
|
}
|
||||||
else if (WorkQueueType == CriticalWorkQueue)
|
else if (WorkQueueType == CriticalWorkQueue)
|
||||||
{
|
{
|
||||||
/* Priority == 5 */
|
/* Priority == 5 */
|
||||||
Priority = EX_CRITICAL_QUEUE_PRIORITY;
|
Priority = EX_CRITICAL_QUEUE_PRIORITY_INCREMENT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Priority == 7 */
|
/* Priority == 7 */
|
||||||
Priority = EX_HYPERCRITICAL_QUEUE_PRIORITY;
|
Priority = EX_HYPERCRITICAL_QUEUE_PRIORITY_INCREMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the Thread */
|
/* Get the Thread */
|
||||||
|
@ -306,7 +306,7 @@ ExpCreateWorkerThread(WORK_QUEUE_TYPE WorkQueueType,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* Set the Priority */
|
/* Set the Priority */
|
||||||
KeSetPriorityThread(&Thread->Tcb, Priority);
|
KeSetBasePriorityThread(&Thread->Tcb, Priority);
|
||||||
|
|
||||||
/* Dereference and close handle */
|
/* Dereference and close handle */
|
||||||
ObDereferenceObject(Thread);
|
ObDereferenceObject(Thread);
|
||||||
|
@ -431,7 +431,7 @@ ExpWorkerThreadBalanceManager(IN PVOID Context)
|
||||||
|
|
||||||
/* Raise our priority above all other worker threads */
|
/* Raise our priority above all other worker threads */
|
||||||
KeSetBasePriorityThread(KeGetCurrentThread(),
|
KeSetBasePriorityThread(KeGetCurrentThread(),
|
||||||
EX_CRITICAL_QUEUE_PRIORITY + 1);
|
EX_CRITICAL_QUEUE_PRIORITY_INCREMENT + 1);
|
||||||
|
|
||||||
/* Setup the timer */
|
/* Setup the timer */
|
||||||
KeInitializeTimer(&Timer);
|
KeInitializeTimer(&Timer);
|
||||||
|
|
|
@ -1177,15 +1177,12 @@ KiSetPriorityThread(PKTHREAD Thread,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sets thread's base priority relative to the process' base priority
|
|
||||||
* Should only be passed in THREAD_PRIORITY_ constants in pstypes.h
|
|
||||||
*
|
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
LONG
|
LONG
|
||||||
STDCALL
|
STDCALL
|
||||||
KeSetBasePriorityThread (PKTHREAD Thread,
|
KeSetBasePriorityThread(PKTHREAD Thread,
|
||||||
LONG Increment)
|
LONG Increment)
|
||||||
{
|
{
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
PKPROCESS Process;
|
PKPROCESS Process;
|
||||||
|
|
Loading…
Reference in a new issue