When developing a DLL, pay attention to the dllmain function, becauseCodeEasy to causeThread deadlock. This msdnArticleBest practices for creating DLLs discusses in depth what issues should be paid attention to during DLL development.
Simply put, the system will automatically generate a loader lock when loading the DLL to prevent multiple DLL files from being loaded at the same time. Loaderlock is automatically locked from the start of calling the API function loadlibrary until dllmain exits. Some developers prefer to write a lot of initialization code in dllmain (for exampleCoinitializeex,LoadLibraryEx,Createproces, creation thread, synchronization thread, Etc ..). The initialization code can easily generate other locks, which leads to deadlocks.
Loader lock:
An example of a deadlock:
> The copyright of the original article belongs to the author. for reprinting, please indicate the source (Http://blog.csdn.net/WinGeek/), Thank you. <