阅读:873回复:0
是文档问题~~~~~~~~~~~~~~还是理解有误?
环境:DS2.7
说明: //KEvent evt_1; //evt_1.Initialize(SynchronizationEvent,FALSE);已经在OnStartDevice例程中初始化 测试程序段: SerialRead() { 。。。。。。。。。。。 t << \"Begin event test\" << EOL; t << \"IRQL=\" << (ULONG)KeGetCurrentIrql() << EOL; //上面显示IRQL=2,DISPATCH_LEVEL LARGE_INTEGER tt; tt.HighPart=-1; tt.LowPart=0xff000000; evt_1.Wait(KernelMode,FALSE,&tt,Executive); //按下面文档所说,上面的Wait应该有问题,应为tt非零,但实际运行很正常! t << \"end of event test\" << EOL; 。。。。。。。。。。。。。。。。。 } DDK文档: “A Timeout of zero allows the testing of a set of wait conditions and for the conditional performance of any side effects if the wait can be immediately satisfied, as in the acquisition of a mutex. Callers of KeWaitForSingleObject must be running at IRQL <= DISPATCH_LEVEL. Usually, the caller must be running at IRQL = PASSIVE_LEVEL and in a nonarbitrary thread context. A call while running at IRQL = DISPATCH_LEVEL is valid if and only if the caller specifies a Timeout of zero. That is, a driver must not wait for a nonzero interval at IRQL = DISPATCH_LEVEL. ” DriverWorks Help文档 “If parameter pTimeOut is not NULL, the wait may time out. If the value pointed to by pTimeOut is greater than zero, it specifies the absolute time when the wait expires. Values less than zero specify an interval relative to the current time. A value of zero instructs the function to test the wait conditions and return STATUS_SUCCESS if they are met, or STATUS_TIMEOUT if not. Time is expressed in units of 100 nanoseconds. The underlying system service is KeWaitSingleObject. The caller must be running at IRQL < DISPATCH_LEVEL unless parameter pTimeOut points to a value of zero, in which case the call may be made from DISPATCH_LEVEL. ” |
|