Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SetThreadDescription function

Assigns a description to a thread.

Syntax


HRESULT WINAPI SetThreadDescription(
  _In_ HANDLE hThread,
  _In_ PCWSTR lpThreadDescription
);

Parameters

hThread [in]

A handle for the thread for which you want to set the description. The handle must have THREAD_SET_LIMITED_INFORMATION access.

lpThreadDescription [in]

A Unicode string that specifies the description of the thread.

Return value

If the function succeeds, the return value is the HRESULT that denotes a successful operation. If the function fails, the return value is an HRESULT that denotes the error.

Remarks

The description of a thread can be set more than once; the most recently set value is used. You can retrieve the description of a thread by calling GetThreadDescription.

Examples

The following example sets the description for the current thread to "simulation_thread".


HRESULT hr = SetThreadDescription(GetCurrentThread(), L"simulation_thread");
if (FAILED(hr))
{
    // Call failed.
}


Requirements

Minimum supported client

Windows 10, version 1607 [desktop apps only]

Minimum supported server

Windows Server 2016 [desktop apps only]

Header

ProcessThreadsApi.h

Library

Kernel32.lib

DLL

Kernel32.dll

See also

GetThreadDescription

 

 

Show:
© 2017 Microsoft