阅读:1747回复:2
为什么我程序停止在KeWaitForSingleObject处了KSEMAPHORE gstartiosem; KSEMAPHORE gdothreadsem; KSEMAPHORE gcmdcpltsem; PCOMMAND gpcmdinthrd = NULL; VOID fThreadPrint(IN PVOID pContex) { OsPrint(("in thread ")); KeReleaseSemaphore(&gdothreadsem, 0, 1, 0); while(1) { OsPrint(("wait cmd in")); KeWaitForSingleObject(&gstartiosem, Executive, KernelMode, FALSE, NULL); ldm_queue_cmd(gpcmdinthrd); OsPrint(("cmd cmplt")); KeReleaseSemaphore(&gcmdcpltsem, 0, 1, 0); } //PsTerminateSystemThread(STATUS_SUCCESS); } void CreateThread() { HANDLE hThread; KeInitializeSemaphore(&gdothreadsem, 1, 1); KeInitializeSemaphore(&gstartiosem, 1, 1); KeInitializeSemaphore(&gcmdcpltsem, 1 ,1); KeWaitForSingleObject(&gdothreadsem, Executive, KernelMode, FALSE, NULL); KeWaitForSingleObject(&gstartiosem, Executive, KernelMode, FALSE, NULL); KeWaitForSingleObject(&gcmdcpltsem, Executive, KernelMode, FALSE, NULL); OsPrint(("create thread")); PsCreateSystemThread(&hThread, 0, NULL, NULL, NULL, fThreadPrint, NULL); KeWaitForSingleObject(&gdothreadsem, Executive, KernelMode, FALSE, NULL); ZwClose(hThread); OsPrint(("exit main thread")); } 然后我在一个函数里等待命令然后唤醒线程,这里是不断的会被调用的。 gpcmdinthrd = pCmd; KeReleaseSemaphore(&gstartiosem, 0, 1, 0); OsPrint(("wait gcmdcpltsem")); KeWaitForSingleObject(&gcmdcpltsem, Executive, KernelMode, FALSE, NULL); OsPrint(("return in OsSendCommand")); 我在Windbg下调试打印时,发现这个线程只运行了一遍,第二遍时就卡在了 KeWaitForSingleObject(&gcmdcpltsem, Executive, KernelMode, FALSE, NULL);这里 拜托各位帮我看看怎么回事 急求解啊 |
|
沙发#
发布于:2011-06-25 16:56
求回复,求帮助
|
|
板凳#
发布于:2011-06-28 10:56
没劲
|
|