Assigns a name to a thread.
BOOL SetThreadName(
HANDLE hThread,
PWSTR lpThreadName
)
hThread
Type: HANDLE
[in] A HANDLE for the thread whose name should be set.
lpThreadName
Type: PWSTR
[in] The name to assign to the thread.
Type: BOOL
Indicates whether the name was successfully assigned to the thread. If the function succeeds the return value is TRUE. If the function fails, the return value is FALSE.
Assigning a name to a thread makes it much easier to identify the thread in development tools like PIX. A thread’s name can be retrieved using GetThreadName.
BOOL success = SetThreadName(GetCurrentThread(), L"Simulation_thread");
if (!success)
{
// call failed
}
Header: Declared in minwinbase.h.
Library: Use toolhelpx.lib.