wince driver中,与中断关联过的EVENT,在IST线程中使用WaitForMultipleObjects fail出错

在WinCE驱动开发过程中,尝试使用WaitForMultipleObjects函数在一个中断服务线程(IST)中处理两个硬件中断,但遇到错误87。经过查阅MS帮助文档,发现与中断关联过的EVENT不能如此使用。为防止遗忘并帮助遇到相同问题的开发者,作者分享了这一经验教训。
摘要由CSDN通过智能技术生成

        最近在做wince的驱动中,想在一个IST线程中处理两个硬件中断,自己想偷懒,不想用两个线程来做,故就用WaitForMultipleObjects函数去等待那两个中断线程,一直不能成功。用GetLastError(),获取msg全是87,说是传参数有问题,但是我两个事件的创建都是成功的啊,没有相应的error的log信息。郁闷了一个下午,后来在查了帮助ms的帮助文档,终于找到原因了,我不能那样干。

 

自己记性不好,故记录在这里,以防自己忘记。同时希望,能对和我犯同样错误的看客有所帮助。呵呵

本文链接地址:http://blog.csdn.net/bbw2008/archive/2011/05/04/6393329.aspx

 

与中断关联过的EVENT,在IST线程中,只能使用

DWORD WaitForSingleObject(
  HANDLE hHandle,
  DWORD dwMilliseconds
);
不能使用
DWORD WaitForMultipleObjects(
  DWORD nCount,
  CONST HANDLE* lpHandles,
  BOOL fWaitAll,
  DWORD dwMilliseconds
);
详细wince的InterruptInitialize函数的帮助文档,
ms-help://MS.VSCC.v80/MS.VSIPCC.v80/MS.WindowsCE.v60.en/CE_OS_IntExplorer/html/4ae3a36b-759a-4103-8251-ecac4c440103.htm

This function must be called before using the hEvent parameter, which provides a link between the idInt parameter and the SYSINTR value returned by an ISR.

The hEvent parameter can be used only in a WaitForSingleObject call to wait for the event to be triggered by the kernel.

A WaitForMultipleObjects call with hEvent fails.

If you use hEvent in a call to WaitForSingleObject before you call InterruptInitialize, InterruptInitialize fails.

InterruptInitialize is a kernel-mode-only function. For more information about kernel-mode-only functions, see Kernel Mode APIs.

InterruptInitialize is used with device drivers and user-mode drivers. For more information about user-mode drivers, see User Mode Driver Framework.

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值