Microsoft KB Archive/304280

= INFO: Disabling Thread Library Calls in Windows CE Can Improve System Performance =

Article ID: 304280

Article Last Modified on 12/27/2003

-

APPLIES TO


 * Microsoft Windows CE 3.0 for the Handheld PC

-



This article was previously published under Q304280



SUMMARY
In Windows CE 3.0, dynamic link libraries (DLLs) that do not require thread notifications can help improve performance in the system by calling DisableThreadLibraryCalls. This disables all DLL_THREAD_ATTACH and DLL_THREAD_DETACH notification calls, which will help improve overall system performance.



MORE INFORMATION
System-level DLLs, driver DLLs, and DLLs that are part of a multithreaded application may not need to receive thread notifications. If all DLLs that do not need thread notifications implement this optimization, it will greatly reduce the number of unnecessary thread notifications that are generated in the system.

To implement this optimization, a DLL should call DisableThreadLibraryCalls from its DLL_PROCESS_ATTACH code in DllMain. For example: BOOL APIENTRY DllMain( HANDLE hModule,                       DWORD  ul_reason_for_call,                        LPVOID lpReserved                     ) { switch (ul_reason_for_call) {   case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls ((HMODULE)hModule); break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: break; } return TRUE; }

Keywords: kbinfo KB304280

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.