问题:
写了个ocx控件,然后在ocx控件注册时注册成功了,但regsvr32还在进程管理器中。
分析后发现在注册ocx控件时,ocx控件的代码CXXXApp::InitInstance会被调用,注册完后CXXXApp::ExitInstance会被调用。
由于在ExitInstance中调用退出线程,并等待线程退出的代码,死锁了,所以regsvr32卡死在进程管理器了。
条件1:
Does creating a thread from DllMain deadlock or doesn't it
Let me get this out of the way up front: Creating a thread from DllMain
is not recommended. The discussion here has to do with explaining the behavior you may observe if you violate this advice.