TlsSetValue

  BOOL TlsSetValue(dwTlsIndex, lpTlsValue)    
  DWORD dwTlsIndex;    
  LPVOID lpTlsValue;    

The TlsSetValue function stores a value in the TLS (thread local storage) that is associated with a specific TLS index value.

Parameters

dwTlsIndex

Supplies a TLS index allocated using TlsAlloc. The index specifies the TLS slot that lpTlsValue will be stored in.

lpTlsValue

The value to be stored in the TLS slot specified by dwTlsIndex.

Return Value

If the function is successful, the return value is TRUE. The value lpTlsValue was stored.

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

Comments

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

The thread-local storage value functions were implemented with speed as the primary goal. These functions perform minimal parameter validation and error checking.

In particular, this function may allow a value to be stored in an index that is in range, but not allocated. It is up to the programmer to ensure that the index is valid.

See Also

TlsAlloc, TlsGetValue, TlsFree