DisableThreadLibraryCalls

This function disables the DLL_THREAD_ATTACH and DLL_THREAD_DETACH notifications for the dynamic-link library (DLL) specified by the hLibModule parameter. Using this function can reduce the size of the working code set for some applications.

BOOL DisableThreadLibraryCalls(
HMODULE hLibModule); 

Parameters

  • hLibModule
    [in] Handle to the DLL module for which the DLL_THREAD_ATTACH and DLL_THREAD_DETACH notifications are to be disabled.

Return Values

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

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, thus reducing the size of the applications 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, then the notification should not be turned off. To implement the optimization, modify a DLLs DLL_PROCESS_ATTACH code to call DisableThreadLibraryCalls.

Requirements

Runs On Versions Defined in Include Link to
Windows CE OS 3.0 and later Winbase.h   Nk.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

GetLastError

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.