Click to Rate and Give Feedback
MSDN
MSDN Library
System Services
 TlsFree Function
TlsFree Function

Releases a thread local storage (TLS) index, making it available for reuse.

Syntax

C++
BOOL WINAPI TlsFree(
  __in  DWORD dwTlsIndex
);

Parameters

dwTlsIndex [in]

The TLS index that was allocated by the TlsAlloc function.

Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If the threads of the process have allocated memory and stored a pointer to the memory in a TLS slot, they should free the memory before calling TlsFree. The TlsFree function does not free memory blocks whose addresses have been stored in the TLS slots associated with the TLS index. It is expected that DLLs call this function (if at all) only during DLL_PROCESS_DETACH.

For more information, see Thread Local Storage.

Examples

For an example, see Using Thread Local Storage or Using Thread Local Storage in a Dynamic-Link Library.

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll

See Also

Processes and Threads Overview
Thread Local Storage
TlsAlloc
TlsGetValue
TlsSetValue

Send comments about this topic to Microsoft

Build date: 11/19/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker