mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
fix broken work item impl.
svn path=/trunk/; revision=11675
This commit is contained in:
parent
22e0d4d8eb
commit
1d44f8fade
1 changed files with 16 additions and 18 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: work.c,v 1.20 2004/10/22 20:18:37 ekohl Exp $
|
/* $Id: work.c,v 1.21 2004/11/15 23:14:36 gdalsnes Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -36,7 +36,7 @@ typedef struct _WORK_QUEUE
|
||||||
/*
|
/*
|
||||||
* PURPOSE: Worker threads with nothing to do wait on this event
|
* PURPOSE: Worker threads with nothing to do wait on this event
|
||||||
*/
|
*/
|
||||||
KSEMAPHORE Sem;
|
KEVENT Event;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PURPOSE: Thread associated with work queue
|
* PURPOSE: Thread associated with work queue
|
||||||
|
@ -84,7 +84,7 @@ ExWorkerThreadEntryPoint(IN PVOID context)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
KeWaitForSingleObject((PVOID)&queue->Sem,
|
KeWaitForSingleObject((PVOID)&queue->Event,
|
||||||
Executive,
|
Executive,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
|
@ -102,9 +102,10 @@ static VOID ExInitializeWorkQueue(PWORK_QUEUE WorkQueue,
|
||||||
|
|
||||||
InitializeListHead(&WorkQueue->Head);
|
InitializeListHead(&WorkQueue->Head);
|
||||||
KeInitializeSpinLock(&WorkQueue->Lock);
|
KeInitializeSpinLock(&WorkQueue->Lock);
|
||||||
KeInitializeSemaphore(&WorkQueue->Sem,
|
KeInitializeEvent(&WorkQueue->Event,
|
||||||
0,
|
SynchronizationEvent,
|
||||||
256);
|
FALSE);
|
||||||
|
|
||||||
for (i=0; i<NUMBER_OF_WORKER_THREADS; i++)
|
for (i=0; i<NUMBER_OF_WORKER_THREADS; i++)
|
||||||
{
|
{
|
||||||
PsCreateSystemThread(&WorkQueue->Thread[i],
|
PsCreateSystemThread(&WorkQueue->Thread[i],
|
||||||
|
@ -164,30 +165,27 @@ ExQueueWorkItem (PWORK_QUEUE_ITEM WorkItem,
|
||||||
ExInterlockedInsertTailList(&EiNormalWorkQueue.Head,
|
ExInterlockedInsertTailList(&EiNormalWorkQueue.Head,
|
||||||
&WorkItem->List,
|
&WorkItem->List,
|
||||||
&EiNormalWorkQueue.Lock);
|
&EiNormalWorkQueue.Lock);
|
||||||
KeReleaseSemaphore(&EiNormalWorkQueue.Sem,
|
KeSetEvent(&EiNormalWorkQueue.Event,
|
||||||
IO_NO_INCREMENT,
|
IO_NO_INCREMENT,
|
||||||
1,
|
FALSE);
|
||||||
FALSE);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CriticalWorkQueue:
|
case CriticalWorkQueue:
|
||||||
ExInterlockedInsertTailList(&EiCriticalWorkQueue.Head,
|
ExInterlockedInsertTailList(&EiCriticalWorkQueue.Head,
|
||||||
&WorkItem->List,
|
&WorkItem->List,
|
||||||
&EiCriticalWorkQueue.Lock);
|
&EiCriticalWorkQueue.Lock);
|
||||||
KeReleaseSemaphore(&EiCriticalWorkQueue.Sem,
|
KeSetEvent(&EiCriticalWorkQueue.Event,
|
||||||
IO_NO_INCREMENT,
|
IO_NO_INCREMENT,
|
||||||
1,
|
FALSE);
|
||||||
FALSE);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HyperCriticalWorkQueue:
|
case HyperCriticalWorkQueue:
|
||||||
ExInterlockedInsertTailList(&EiHyperCriticalWorkQueue.Head,
|
ExInterlockedInsertTailList(&EiHyperCriticalWorkQueue.Head,
|
||||||
&WorkItem->List,
|
&WorkItem->List,
|
||||||
&EiHyperCriticalWorkQueue.Lock);
|
&EiHyperCriticalWorkQueue.Lock);
|
||||||
KeReleaseSemaphore(&EiHyperCriticalWorkQueue.Sem,
|
KeSetEvent(&EiHyperCriticalWorkQueue.Event,
|
||||||
IO_NO_INCREMENT,
|
IO_NO_INCREMENT,
|
||||||
1,
|
FALSE);
|
||||||
FALSE);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef __USE_W32API
|
#ifdef __USE_W32API
|
||||||
|
|
Loading…
Reference in a new issue