Hello everybody.
I did a test, seems my event notification in the driver didn’t wake up the
application each time.
In the driver I used:
////////////////////////////////////////////////////////////////
if (gUserEvent!=NULL)
{
DbgPrint(“Set Event: \n”);
ASSERT(KeGetCurrentIrql()<=DISPATCH_LEVEL);
KeClearEvent(gUserEvent);
KeSetEvent(gUserEvent, 0, FALSE);
}
///////////////////////////////////////////////////////////
In the application I used:
///////////////////////////////////////////////////////////
while(1)
{
status = WaitForSingleObject(api.m_hEvent, INFINITE);
if (status == WAIT_ABANDONED || status == WAIT_OBJECT_0 || status ==
WAIT_TIMEOUT)
/* I used if (status == WAIT_OBJECT_0 ) the first time, the counts in the
application is less than the counts in the kernel, so I * changed to this
code */
{
printf(“got event %d\n”, api.k);
// api.GetPacket();
// api.GetPacket();
api.k++;
}
}
///////////////////////////////////////////////////////////
still, the counts in the application is much less than the counts in kernel.
Any ideas? Thanks!
Yuanhui
YuanHui, FYI,
There is an article about sharing event between kernel and
user program at
http://www.codeproject.com/system/driveguicomm.asp
Hope this will help.
-----Original Message-----
From: Yuanhui Zhao [mailto:xxxxx@nexland.com]
Sent: Friday, August 23, 2002 2:40 PM
To: NT Developers Interest List
Subject: [ntdev] Event notification
Hello everybody.
I did a test, seems my event notification in the driver didn’t wake up the
application each time.
In the driver I used:
////////////////////////////////////////////////////////////////
if (gUserEvent!=NULL)
{
DbgPrint(“Set Event: \n”);
ASSERT(KeGetCurrentIrql()<=DISPATCH_LEVEL);
KeClearEvent(gUserEvent);
KeSetEvent(gUserEvent, 0, FALSE);
}
///////////////////////////////////////////////////////////
In the application I used:
///////////////////////////////////////////////////////////
while(1)
{
status = WaitForSingleObject(api.m_hEvent, INFINITE);
if (status == WAIT_ABANDONED || status == WAIT_OBJECT_0 || status ==
WAIT_TIMEOUT)
/* I used if (status == WAIT_OBJECT_0 ) the first time, the counts in the
application is less than the counts in the kernel, so I * changed to this
code */
{
printf(“got event %d\n”, api.k);
// api.GetPacket();
// api.GetPacket();
api.k++;
}
}
///////////////////////////////////////////////////////////
still, the counts in the application is much less than the counts in kernel.
Any ideas? Thanks!
Yuanhui
You are currently subscribed to ntdev as: xxxxx@emc.com
To unsubscribe send a blank email to %%email.unsub%%
And what else would you expect? Driver clears and sets event quickly whereas
app printfs something so event can be cleared and set several times before
app calls wait again. Note printf can be really slow comparing to driver
loop. Try another test: use two events, drivers sets one and waits for the
second and apps waits for the first and then sets the second.
Best regards,
Michal Vodicka
STMicroelectronics Design and Application s.r.o.
[michal.vodicka@st.com, http:://www.st.com]
From: xxxxx@nexland.com[SMTP:xxxxx@nexland.com]
Reply To: xxxxx@lists.osr.com
Sent: Friday, August 23, 2002 8:40 PM
To: xxxxx@lists.osr.com
Subject: [ntdev] Event notification
Hello everybody.
I did a test, seems my event notification in the driver didn’t wake up the
application each time.
In the driver I used:
////////////////////////////////////////////////////////////////
if (gUserEvent!=NULL)
{
DbgPrint(“Set Event: \n”);
ASSERT(KeGetCurrentIrql()<=DISPATCH_LEVEL);
KeClearEvent(gUserEvent);
KeSetEvent(gUserEvent, 0, FALSE);
}
///////////////////////////////////////////////////////////
In the application I used:
///////////////////////////////////////////////////////////
while(1)
{
status = WaitForSingleObject(api.m_hEvent, INFINITE);
if (status == WAIT_ABANDONED || status == WAIT_OBJECT_0 || status ==
WAIT_TIMEOUT)
/* I used if (status == WAIT_OBJECT_0 ) the first time, the counts in the
application is less than the counts in the kernel, so I * changed to this
code */
{
printf(“got event %d\n”, api.k);
// api.GetPacket();
// api.GetPacket();
api.k++;
}
}
///////////////////////////////////////////////////////////
still, the counts in the application is much less than the counts in
kernel.
Any ideas? Thanks!
Yuanhui
You are currently subscribed to ntdev as: michal.vodicka@st.com
To unsubscribe send a blank email to %%email.unsub%%
Thanks Michal, I will do a test.
Yuanhui
----- Original Message -----
From: “Michal Vodicka”
To: “NT Developers Interest List”
Sent: Friday, August 23, 2002 3:42 PM
Subject: [ntdev] RE: Event notification
> And what else would you expect? Driver clears and sets event quickly
whereas
> app printfs something so event can be cleared and set several times before
> app calls wait again. Note printf can be really slow comparing to driver
> loop. Try another test: use two events, drivers sets one and waits for the
> second and apps waits for the first and then sets the second.
>
> Best regards,
>
> Michal Vodicka
> STMicroelectronics Design and Application s.r.o.
> [michal.vodicka@st.com, http:://www.st.com]
>
> > ----------
> > From: xxxxx@nexland.com[SMTP:xxxxx@nexland.com]
> > Reply To: xxxxx@lists.osr.com
> > Sent: Friday, August 23, 2002 8:40 PM
> > To: xxxxx@lists.osr.com
> > Subject: [ntdev] Event notification
> >
> > Hello everybody.
> >
> > I did a test, seems my event notification in the driver didn’t wake up
the
> > application each time.
> >
> > In the driver I used:
> > ////////////////////////////////////////////////////////////////
> > if (gUserEvent!=NULL)
> > {
> > DbgPrint(“Set Event: \n”);
> >
> > ASSERT(KeGetCurrentIrql()<=DISPATCH_LEVEL);
> >
> > KeClearEvent(gUserEvent);
> >
> > KeSetEvent(gUserEvent, 0, FALSE);
> > }
> > ///////////////////////////////////////////////////////////
> >
> > In the application I used:
> > ///////////////////////////////////////////////////////////
> > while(1)
> > {
> > status = WaitForSingleObject(api.m_hEvent, INFINITE);
> > if (status == WAIT_ABANDONED || status == WAIT_OBJECT_0 || status
==
> > WAIT_TIMEOUT)
> > /* I used if (status == WAIT_OBJECT_0 ) the first time, the counts in
the
> > application is less than the counts in the kernel, so I * changed to
this
> > code */
> > {
> > printf(“got event %d\n”, api.k);
> > // api.GetPacket();
> > // api.GetPacket();
> > api.k++;
> > }
> > }
> >
> > ///////////////////////////////////////////////////////////
> >
> > still, the counts in the application is much less than the counts in
> > kernel.
> >
> > Any ideas? Thanks!
> >
> > Yuanhui
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: michal.vodicka@st.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nexland.com
> To unsubscribe send a blank email to %%email.unsub%%
>
If you set an event that is already set your application will count one
trigger, not two. Events are not counters, they are boolean switches that
are either signalled or not-signalled.
-----Original Message-----
From: Yuanhui Zhao [mailto:xxxxx@nexland.com]
Sent: Friday, August 23, 2002 2:40 PM
To: NT Developers Interest List
Subject: [ntdev] Event notification
Hello everybody.
I did a test, seems my event notification in the driver
didn’t wake up the application each time.
In the driver I used:
////////////////////////////////////////////////////////////////
if (gUserEvent!=NULL)
{
DbgPrint(“Set Event: \n”);
ASSERT(KeGetCurrentIrql()<=DISPATCH_LEVEL);
KeClearEvent(gUserEvent);
KeSetEvent(gUserEvent, 0, FALSE);
} ///////////////////////////////////////////////////////////
In the application I used:
///////////////////////////////////////////////////////////
while(1)
{
status = WaitForSingleObject(api.m_hEvent, INFINITE);
if (status == WAIT_ABANDONED || status == WAIT_OBJECT_0
|| status ==
WAIT_TIMEOUT)
/* I used if (status == WAIT_OBJECT_0 ) the first time, the
counts in the application is less than the counts in the
kernel, so I * changed to this code */
{
printf(“got event %d\n”, api.k);
// api.GetPacket();
// api.GetPacket();
api.k++;
}
}
///////////////////////////////////////////////////////////
still, the counts in the application is much less than the
counts in kernel.
Any ideas? Thanks!
Yuanhui
You are currently subscribed to ntdev as:
xxxxx@stratus.com To unsubscribe send a blank email to
%%email.unsub%%
Thanks Mark,
That’s why I clear the event before set it.
KeClearEvent(gUserEvent);
KeSetEvent(gUserEvent, 0, FALSE);
Michal is correct, the kernel cleared the event too fast for the application
to respond.
Regard,
Yuanhui
----- Original Message -----
From: “Roddy, Mark”
To: “NT Developers Interest List”
Sent: Friday, August 23, 2002 4:29 PM
Subject: [ntdev] RE: Event notification
> If you set an event that is already set your application will count one
> trigger, not two. Events are not counters, they are boolean switches that
> are either signalled or not-signalled.
>
> > -----Original Message-----
> > From: Yuanhui Zhao [mailto:xxxxx@nexland.com]
> > Sent: Friday, August 23, 2002 2:40 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Event notification
> >
> >
> > Hello everybody.
> >
> > I did a test, seems my event notification in the driver
> > didn’t wake up the application each time.
> >
> > In the driver I used:
> > ////////////////////////////////////////////////////////////////
> > if (gUserEvent!=NULL)
> > {
> > DbgPrint(“Set Event: \n”);
> >
> > ASSERT(KeGetCurrentIrql()<=DISPATCH_LEVEL);
> >
> > KeClearEvent(gUserEvent);
> >
> > KeSetEvent(gUserEvent, 0, FALSE);
> > } ///////////////////////////////////////////////////////////
> >
> > In the application I used:
> > ///////////////////////////////////////////////////////////
> > while(1)
> > {
> > status = WaitForSingleObject(api.m_hEvent, INFINITE);
> > if (status == WAIT_ABANDONED || status == WAIT_OBJECT_0
> > || status ==
> > WAIT_TIMEOUT)
> > /* I used if (status == WAIT_OBJECT_0 ) the first time, the
> > counts in the application is less than the counts in the
> > kernel, so I * changed to this code */
> > {
> > printf(“got event %d\n”, api.k);
> > // api.GetPacket();
> > // api.GetPacket();
> > api.k++;
> > }
> > }
> >
> > ///////////////////////////////////////////////////////////
> >
> > still, the counts in the application is much less than the
> > counts in kernel.
> >
> > Any ideas? Thanks!
> >
> > Yuanhui
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as:
> > xxxxx@stratus.com To unsubscribe send a blank email to
> > %%email.unsub%%
> >
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nexland.com
> To unsubscribe send a blank email to %%email.unsub%%
>