Never say Never

人在江湖,身不由己...

http://blogs.msdn.com/oleglv/archive/2003/10/24/56141.aspx再三声明,

 

Chris Brumme lists the following things that should never, ever be done in DllMain.

·         Dynamic binds. That includes LoadLibrary/UnloadLibrary calls or anything that may call implicitly call them

·         Locking of any kind. If you are trying to acquire a lock that is currently help by a thread that needs OS loader lock (which you may be holding), you'll deadlock.

·         Cross-binary calls. As been discussed the binary youre calling into may not have been initialized or have already been unutilized.

·         Starting new threads and then wait for completion. As discussed, thread in question may need to acquire OS lock that you are holding.

 

悲剧还是会发生的。

posted @ 2009-05-18 16:53  Pang pang Xiong  阅读(258)  评论(0编辑  收藏  举报