TlsFree

  BOOL TlsFree(dwTlsIndex)    
  DWORD dwTlsIndex;    

The TlsFree function frees a valid TLS (thread local storage) index.

Parameters

dwTlsIndex

Supplies a TLS index allocated using TlsAlloc. If the index is a valid index, it is released by this call and made available for reuse.

Return Value

If the function is successful, the return value is TRUE. The index is free to be reallocated by TlsAlloc.

If the function fails, the return value is FALSE. The function fails when the index is invalid. More detailed information can be obtained by calling the GetLastError function.

Comments

DLLs should be careful to release any per-thread data pointed to by all of their threads' TLS slots before calling this function. It is expected that DLLs will only call this function (if at ALL) during their process detach routine.

See the Comments section of TlsAlloc for a brief discussion of typical uses of the Tls* functions.

See Also

TlsAlloc, TlsGetValue, TlsSetValue