zyhflorida
驱动牛犊
驱动牛犊
  • 注册日期2002-08-09
  • 最后登录2003-11-25
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1075回复:2

event notification

楼主#
更多 发布于:2002-08-24 02:34
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!
zyhflorida
驱动牛犊
驱动牛犊
  • 注册日期2002-08-09
  • 最后登录2003-11-25
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2002-08-24 05:13
case closed. because kernel is too fast to set and clear the event, so the application lost some notifications.
mikeyredmoon
驱动牛犊
驱动牛犊
  • 注册日期2007-07-25
  • 最后登录2016-01-09
  • 粉丝0
  • 关注0
  • 积分271分
  • 威望55点
  • 贡献值0点
  • 好评度53点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2007-08-09 11:14
我也遇到同样的问题了,驱动里面setevent太快,外面处理比较慢,怎么解决阿
游客

返回顶部