GetCurrentThreadId function (processthreadsapi.h)

Retrieves the thread identifier of the calling thread.

Syntax

DWORD GetCurrentThreadId();

Return value

The return value is the thread identifier of the calling thread.

Remarks

Until the thread terminates, the thread identifier uniquely identifies the thread throughout the system.

Examples

For an example, see Using Thread Local Storage.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps | UWP apps]
Minimum supported server Windows Server 2003 [desktop apps | UWP apps]
Target Platform Windows
Header processthreadsapi.h (include Windows.h on Windows Server 2003, Windows Vista, Windows 7, Windows Server 2008 Windows Server 2008 R2)
Library Kernel32.lib
DLL Kernel32.dll

See also

GetCurrentThread

OpenThread

Process and Thread Functions

Threads

Vertdll APIs available in VBS enclaves