Hi All,
I am trying to synchronize one system thread and a DPC as signalled from DPC.
Description:
=========
In a thread (created by PsCreateSystemThread) we are waiting for an event as follows :
Fn1()
{
While(1)
{
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL); /*Blocking call /
KeResetEvent(&Event);
/ Our code */
}
}
In DPC we raise event by calling :
Fn2()
{
KeSetEvent(&Event,IO_NO_INCREMENT,FALSE);
}
The DPC is scheduled for every few milliseconds. Fn2 and Fn1 executes alternative for few seconds after which the thread of Fn1() is not being scheduled alternatively as expected and starts after Fn2() has got executed for few times.
Could anybody suggest me the reason for this misbehavior? If possible any solution would be very much appreciated.
Regards,
Cyril
They are beautiful. They are in danger. Our four-legged friends.
Use IoQueueWorkItem instead of using the system thread.
Max
----- Original Message -----
From: sagaya cyril
To: Windows System Software Developers Interest List
Sent: Tuesday, July 22, 2003 8:43 PM
Subject: [ntdev] Signalling event problem in WDM Driver between DPC and system thread
Hi All,
I am trying to synchronize one system thread and a DPC as signalled from DPC.
Description:
In a thread (created by PsCreateSystemThread) we are waiting for an event as follows :
Fn1()
{
While(1)
{
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL); /*Blocking call */
KeResetEvent(&Event);
/* Our code */
}
}
In DPC we raise event by calling :
Fn2()
{
KeSetEvent(&Event,IO_NO_INCREMENT,FALSE);
}
The DPC is scheduled for every few milliseconds. Fn2 and Fn1 executes alternative for few seconds after which the thread of Fn1() is not being scheduled alternatively as expected and starts after Fn2() has got executed for few times.
Could anybody suggest me the reason for this misbehavior? If possible any solution would be very much appreciated.
Regards,
Cyril
They are beautiful. They are in danger. Our four-legged friends. ---
You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
You see, when event is signalled is means that your thread is eligible for
execution and marked as ready. If there is another thread is currently
executing or in a ready state your thread may wait its turn. It may take
much more then few miliseconds.
Basically you need to review your design so it will tolerate missing events.
DPC may save context and put an item in some queue. When woker thread is
signalled it should expect to find and handle several items in the queue.
Alexei.
“sagaya cyril” wrote in message
news:xxxxx@ntdev…
>Hi All,
>
>I am trying to synchronize one system thread and a DPC as signalled from
DPC.
>
>Description:
>=========
>In a thread (created by PsCreateSystemThread) we are waiting for an event
as follows :
>Fn1()
>{
>While(1)
>{
>KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL); /*Blocking
call /
>KeResetEvent(&Event);
>/ Our code */
>}
>}
>
>In DPC we raise event by calling :
>
>Fn2()
>{
>KeSetEvent(&Event,IO_NO_INCREMENT,FALSE);
>}
>
>
>The DPC is scheduled for every few milliseconds. Fn2 and Fn1 executes
alternative for few seconds after which the thread of Fn1() is not being
scheduled alternatively >as expected and starts after Fn2() has got executed
for few times.
>
>Could anybody suggest me the reason for this misbehavior? If possible any
solution would be very much appreciated.
>
>Regards,
>Cyril
Hi Max,Alex and Roddy,
It worked , I am able to synchronize the threads . I used
IoQueueWorkItem to create a thread and semaphore as the synchronizing machenisam between them.
Thanks to you all.
Reagrds,
Cyril
----- Original Message -----
From: Maxim S. Shatskih
To: Windows System Software Developers Interest List
Sent: Wednesday, July 23, 2003 2:23 AM
Subject: [ntdev] Re: Signalling event problem in WDM Driver between DPC and system thread
Use IoQueueWorkItem instead of using the system thread.
Max
----- Original Message -----
From: sagaya cyril
To: Windows System Software Developers Interest List
Sent: Tuesday, July 22, 2003 8:43 PM
Subject: [ntdev] Signalling event problem in WDM Driver between DPC and system thread
Hi All,
I am trying to synchronize one system thread and a DPC as signalled from DPC.
Description:
=========
In a thread (created by PsCreateSystemThread) we are waiting for an event as follows :
Fn1()
{
While(1)
{
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL); /*Blocking call /
KeResetEvent(&Event);
/ Our code */
}
}
In DPC we raise event by calling :
Fn2()
{
KeSetEvent(&Event,IO_NO_INCREMENT,FALSE);
}
The DPC is scheduled for every few milliseconds. Fn2 and Fn1 executes alternative for few seconds after which the thread of Fn1() is not being scheduled alternatively as expected and starts after Fn2() has got executed for few times.
Could anybody suggest me the reason for this misbehavior? If possible any solution would be very much appreciated.
Regards,
Cyril
They are beautiful. They are in danger. Our four-legged friends. —
You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
You are currently subscribed to ntdev as: xxxxx@wipro.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
They are beautiful. They are in danger. Our four-legged friends.