UID | tech.root | title | ms.date | ms.keywords | targetos | description | prerelease | req.assembly | req.construct-type | req.ddi-compliance | req.lib | req.dll | req.apiset | req.header | req.idl | req.include-header | req.irql | req.kmdf-ver | req.max-support | req.namespace | req.redist | req.target-min-winverclnt | req.target-min-winversvr | req.target-type | req.type-library | req.umdf-ver | req.unicode-ansi | topic_type | api_type | api_location | api_name | f1_keywords | dev_langs | helpviewer_keywords | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NF:processthreadsapi.TlsGetValue2 |
processthreadsapi |
TlsGetValue2 function (processthreadsapi.h) |
08/07/2024 |
TlsGetValue2, TlsGetValue2 function, _win32_tlsgetvalue2, base.tlsgetvalue2, processthreadsapi/TlsGetValue2, winbase/TlsGetValue2 |
Windows |
Retrieves the value in the calling thread's thread local storage (TLS) slot for the specified TLS index. Each thread of a process has its own slot for each TLS index. |
true |
function |
Kernel32.lib |
Kernel32.dll |
api-ms-win-core-processthreads-l1-1-8 |
processthreadsapi.h |
Windows 11, version 24H2 |
Windows |
|
|
|
|
|
|
|
Retrieves the value in the calling thread's thread local storage (TLS) slot for the specified TLS index. Each thread of a process has its own slot for each TLS index.
The TLS index that was allocated by the TlsAlloc function.
If the function succeeds, the return value is the value stored in the calling thread's TLS slot associated with the specified index. If dwTlsIndex is a valid index allocated by a successful call to TlsAlloc, this function always succeeds.
If the function fails, the return value is zero.
TLS indexes are typically allocated by the TlsAlloc function during process or DLL initialization. After a TLS index is allocated, each thread of the process can use it to access its own TLS slot for that index. A thread specifies a TLS index in a call to TlsSetValue to store a value in its slot. The thread specifies the same index in a subsequent call to TlsGetValue2 to retrieve the stored value.
TlsGetValue2 was implemented with speed as the primary goal. The function performs minimal parameter validation and error checking. In particular, it succeeds if dwTlsIndex is in the range 0 through (TLS_MINIMUM_AVAILABLE– 1). It is up to the programmer to ensure that the index is valid and that the thread calls TlsSetValue before calling TlsGetValue2.
This function is identical to TlsGetValue except that it doesn't set the thread's last error. Applications calling this function should avoid using 0 as a valid value, because GetLastError cannot be called to check if the function failed.
See Using Thread Local Storage or Using Thread Local Storage in a Dynamic-Link Library.