DisableThreadLibraryCalls 的作用
2010-07-01 11:55
239 查看
第一篇文章
看Wince驱动时,看到Init函数时不时有这个函数,不知道啥意思,
BOOL DisableThreadLibraryCalls(
HMODULE hLibModule
);
This function disables the DLL_THREAD_ATTACH and DLL_THREAD_DETACH notifications for the DLL specified by the hLibModule parameter.
Using this function can reduce the size of the working code set for some applications.
The DisableThreadLibraryCalls function lets a DLL disable the DLL_THREAD_ATTACH and DLL_THREAD_DETACH notification calls.
This can be a useful optimization for multithreaded applications that have many DLLs, frequently create and delete threads, and whose DLLs do not need these thread-level notifications of attachment/detachment.
By disabling the notifications, the DLL initialization code is not paged-in because a thread is created or deleted, which reduces the size of the application's working code set.
Disabling the notification calls can be used for any DLL where there is no thread-level tracking required. If you need to track resources on a thread-by-thread basis, the notification should not be turned off.
To implement the optimization, modify a DLL's DLL_PROCESS_ATTACH code to call DisableThreadLibraryCalls.
Drivers that exist in the Device Manager Device.exe process space should call DisableThreadLibraryCalls if no thread-specific data is needed.
重点:
This can be a useful optimization for multithreaded applications that have many DLLs, frequently create and delete threads, and whose DLLs do not need these thread-level notifications of attachment/detachment.
该函数在有许多DLL,频繁创建和删除线程,并且DLL不需要线程级消息如DLL_THREAD_ATTACH and DLL_THREAD_DETACH时的多线程应用中是很有效的优化。
看Wince驱动时,看到Init函数时不时有这个函数,不知道啥意思,
BOOL DisableThreadLibraryCalls(
HMODULE hLibModule
);
This function disables the DLL_THREAD_ATTACH and DLL_THREAD_DETACH notifications for the DLL specified by the hLibModule parameter.
Using this function can reduce the size of the working code set for some applications.
Remarks
Windows CE does not support static-thread local storage; therefore, the only restriction for specifying a DLL to disable is that it is a valid module.The DisableThreadLibraryCalls function lets a DLL disable the DLL_THREAD_ATTACH and DLL_THREAD_DETACH notification calls.
This can be a useful optimization for multithreaded applications that have many DLLs, frequently create and delete threads, and whose DLLs do not need these thread-level notifications of attachment/detachment.
By disabling the notifications, the DLL initialization code is not paged-in because a thread is created or deleted, which reduces the size of the application's working code set.
Disabling the notification calls can be used for any DLL where there is no thread-level tracking required. If you need to track resources on a thread-by-thread basis, the notification should not be turned off.
To implement the optimization, modify a DLL's DLL_PROCESS_ATTACH code to call DisableThreadLibraryCalls.
Drivers that exist in the Device Manager Device.exe process space should call DisableThreadLibraryCalls if no thread-specific data is needed.
重点:
This can be a useful optimization for multithreaded applications that have many DLLs, frequently create and delete threads, and whose DLLs do not need these thread-level notifications of attachment/detachment.
该函数在有许多DLL,频繁创建和删除线程,并且DLL不需要线程级消息如DLL_THREAD_ATTACH and DLL_THREAD_DETACH时的多线程应用中是很有效的优化。
相关文章推荐
- 0.VC(Custom)-DisableThreadLibraryCalls
- DllMain中不当操作导致死锁问题的分析--DisableThreadLibraryCalls对DllMain中死锁的影响
- 简介: DisableThreadLibraryCalls
- DllMain中不当操作导致死锁问题的分析--DisableThreadLibraryCalls对DllMain中死锁的影响
- DisableThreadLibraryCalls
- [转载]DllMain中不当操作导致死锁问题的分析--DisableThreadLibraryCalls对DllMain中死锁的影响
- DisableThreadLibraryCalls
- ios沙盒 以及 Documents、Library和tmp的作用
- Thread Interruption in Boost Thread Library
- 【工作笔记0007】Control.CheckForIllegalCrossThreadCalls = false 多线程访问UI
- 关于pkg-config与LD_LIBRARY_PATH与/etc/ld.so.conf文件的区别与作用
- Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc11 in java.library.path
- Thread的setDaemon(true)方法的作用
- CheckForIllegalCrossThreadCalls 多个线程操作某一控件
- System.Windows.Forms.Form.CheckForIllegalCrossThreadCalls = false;
- iOS Documents、Library和tmp的作用
- 隐含参数_disable_logging对数据库的负作用(1)
- Intel open-sourced a multithread library
- [MySQL优化案例]系列 -- DISABLE/ENABLE KEYS的作用
- How to: Make Thread-Safe Calls to Windows Forms Controls