GetCurrentThreadId

The GetCurrentThreadId function retrieves the identifier of the current thread. The thread identifier is a 64-bit value that is unique among all currently running threads. It is not the same as the thread's handle.

DWORD GetCurrentThreadId();

Parameters

This function does not take any parameters.

Return Value

The return value is the identifier of the calling thread.

Remarks

To get a handle to the current thread, call the GetCurrentThread function.

The thread identifier is assigned by the system and is guaranteed to be unique only for the lifetime of the calling process. It may be reused after the thread has terminated.

Requirements

Component Value
Minimum supported client Windows 2000 Professional
Minimum supported server Windows 2000 Server
Header winbase.h (include windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See Also

Important: This is a simplified example. Real MSDN documentation includes more details, code samples, and cross-references.