Menu

Application Verifier break message

Waiting on a thread handle in DllMain.

Probable cause

This stop is generated when the current thread is running code inside the DllMain function of one of the DLLs loaded in the current process and it calls WaitForSingleObject or WaitForMultipleObjects to wait on a thread handle in the same process.

This condition will most likely lead to a deadlock because the thread handle will not get signaled unless that second thread is exiting. When the second thread calls ExitThread it will try to acquire the DLL loader lock then call DllMain (DLL_THREAD_DETACH) for all DLLs in the current process. But the loader lock is owned by the first thread (the one that is waiting on the thread handle) so the two threads will deadlock.

Information displayed by Application Verifier

Parameter1 - Thread handle

Parameter2 - Not used

Parameter3 - Not used

Parameter4 - Not used

Description - Waiting on a thread handle in DllMain

Additional information

Verifier stop code 0304.

Frequency of this error is low.

The debugee hangs. 'StopDebugging' required