wince driver中,与中断关联过的EVENT,在IST线程中使用WaitForMultipleObjects fail出错
最近在做wince的驱动中,想在一个IST线程中处理两个硬件中断,自己想偷懒,不想用两个线程来做,故就用WaitForMultipleObjects函数去等待那两个中断线程,一直不能成功。用GetLastError(),获取msg全是87,说是传参数有问题,但是我两个事件的创建都是成功的啊,没有相应的error的log信息。郁闷了一个下午,后来在查了帮助ms的帮助文档,终于找到原因了,我不能那样干。
自己记性不好,故记录在这里,以防自己忘记。同时希望,能对和我犯同样错误的看客有所帮助。呵呵
与中断关联过的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
阅读(1889) | 评论(0) | 转发(0) |