TlsGetValue

  LPVOID TlsGetValue(dwTlsIndex)    
  DWORD dwTlsIndex;    

The TlsGetValue function retrieves the 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 whose value is to be retrieved.

Return Value

If the return value is not equal to zero, the function was successful. The return value is the data stored in the TLS slot associated with the specified index.

If the return value is equal to zero, either the function failed, or the data stored in the TLS slot associated with the specified index has a value of zero. If a subsequent call to GetLastError for extended error information returns a non-zero value, the function failed. Function failure is due to an invalid index.

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 return a non-zero value for 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, TlsSetValue, TlsFree