阅读:1531回复:4
在驱动中使用线程,不停死机,郁闷中,求解!
在驱动中自己创建了一个线程,但是在结束线程时,蓝屏。并且提示如下:
An executive worker thread is being terminated without having gone through the worker thread rundown code; work items queued to the Ex worker queue must not terminate their threads,A stack trace should indicate the culprit. 创建线程代码: PDEVICE_EXTENSION pdx; KeInitializeSpinLock( &pdx->lkIrpQueue ); InitializeListHead( &pdx->IrpQueueListHead ); KeInitializeSemaphore( &pdx->semIrpQueue, 0, MAXLONG); status = PsCreateSystemThread( &hThread, (ACCESS_MASK)0, NULL, (HANDLE)0, NULL, WorkerThreadMain, pdx ); 结束线程: KeReleaseSemaphore( &pDE->semIrpQueue, 0,1, TRUE ); KeWaitForSingleObject(&pDE->pThreadObj, Executive, KernelMode, FALSE, NULL ); ObDereferenceObject( &pDE->pThreadObj ); PsTerminateSystemThread(STATUS_SUCCESS); 各位朋友,帮忙看看 |
|
沙发#
发布于:2007-05-17 12:03
自己顶一下
创建线程是不是要在driverentry中进行,那device_extension从initialdata结构中获取啊? |
|