[ros-dev] RE: [ros-diffs] [CVS reactos] fix broken work item impl.

Hartmut Birr hartmut.birr at gmx.de
Tue Nov 16 18:39:03 CET 2004


Hi Gunnar,
 
for synchronisation between an unlimited count of objects (or 256) in a wait
queue and more than one waiters which removes this objects, there _must_ be
used a semaphore (or equivalent code). Please revert your changes.
 
- Hartmut  

-----Original Message-----
From: ros-diffs-bounces at reactos.com [mailto:ros-diffs-bounces at reactos.com]
On Behalf Of gdalsnes at osexperts.com
Sent: Tuesday, November 16, 2004 12:15 AM
To: ros-diffs at reactos.com
Subject: [ros-diffs] [CVS reactos] fix broken work item impl.


Commit in reactos/ntoskrnl/ex on MAIN	
work.c <> 	 +16	 -18	 1.20
<http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ex/work.c?rev=1.20&c
ontent-type=text/x-cvsweb-markup>  -
<http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ex/work.c.diff?r1=te
xt&tr1=1.20&r2=text&tr2=1.21&f=h> > 1.21
<http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ex/work.c?rev=1.21&c
ontent-type=text/x-cvsweb-markup> 	
fix broken work item impl.
  _____  


reactos <http://cvs.reactos.com/cgi-bin/cvsweb/reactos> /ntoskrnl
<http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl> /ex
<http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ex> 

work.c 1.20
<http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ex/work.c?rev=1.20&c
ontent-type=text/x-cvsweb-markup>  -
<http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ex/work.c.diff?r1=te
xt&tr1=1.20&r2=text&tr2=1.21&f=h> > 1.21
<http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ex/work.c?rev=1.21&c
ontent-type=text/x-cvsweb-markup> 
diff -u -r1.20 -r1.21

--- work.c	22 Oct 2004 20:18:37 -0000	1.20

+++ work.c	15 Nov 2004 23:14:36 -0000	1.21

@@ -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

  * PROJECT:            ReactOS kernel
@@ -36,7 +36,7 @@


    /*

     * PURPOSE: Worker threads with nothing to do wait on this event

     */
-   KSEMAPHORE Sem;
+   KEVENT Event;
    

    /*

     * PURPOSE: Thread associated with work queue
@@ -84,7 +84,7 @@


 	  }

 	else

 	  {
-	     KeWaitForSingleObject((PVOID)&queue->Sem,
+	     KeWaitForSingleObject((PVOID)&queue->Event,
 				   Executive,

 				   KernelMode,

 				   FALSE,
@@ -102,9 +102,10 @@


    

    InitializeListHead(&WorkQueue->Head);

    KeInitializeSpinLock(&WorkQueue->Lock);
-   KeInitializeSemaphore(&WorkQueue->Sem,

-			 0,

-			 256);
+   KeInitializeEvent(&WorkQueue->Event,

+                     SynchronizationEvent,

+                     FALSE);   

+
    for (i=0; i<NUMBER_OF_WORKER_THREADS; i++)

      {

 	PsCreateSystemThread(&WorkQueue->Thread[i],
@@ -164,30 +165,27 @@


 	    ExInterlockedInsertTailList(&EiNormalWorkQueue.Head,

 				    &WorkItem->List,

 				    &EiNormalWorkQueue.Lock);
-	    KeReleaseSemaphore(&EiNormalWorkQueue.Sem,

-			   IO_NO_INCREMENT,

-			   1,

-			   FALSE);
+       KeSetEvent(&EiNormalWorkQueue.Event,

+                  IO_NO_INCREMENT,

+                  FALSE);
 	break;

 	

     case CriticalWorkQueue:

         ExInterlockedInsertTailList(&EiCriticalWorkQueue.Head,

 				    &WorkItem->List,

 				    &EiCriticalWorkQueue.Lock);
-        KeReleaseSemaphore(&EiCriticalWorkQueue.Sem,

-	       	  	   IO_NO_INCREMENT,

-	       		   1,

-	       		   FALSE);
+        KeSetEvent(&EiCriticalWorkQueue.Event,

+                   IO_NO_INCREMENT,

+                   FALSE);
 	    break;

 

     case HyperCriticalWorkQueue:

 	    ExInterlockedInsertTailList(&EiHyperCriticalWorkQueue.Head,

 				    &WorkItem->List,

 				    &EiHyperCriticalWorkQueue.Lock);
-	    KeReleaseSemaphore(&EiHyperCriticalWorkQueue.Sem,

-			   IO_NO_INCREMENT,

-			   1,

-			   FALSE);
+       KeSetEvent(&EiHyperCriticalWorkQueue.Event,

+                  IO_NO_INCREMENT,

+                  FALSE);
     	break;

 

 #ifdef __USE_W32API
email" href="http://www.badgers-in-foil.co.uk/projects/cvsspam/">CVSspam
0.2.8

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://reactos.com:8080/pipermail/ros-dev/attachments/20041116/ee917cda/attachment.htm


More information about the Ros-dev mailing list