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.

GetThreadInformation function

Retrieves information about the specified thread.

Syntax


 BOOL  GetThreadInformation(
  _In_ HANDLE                   hThread,
  _In_ THREAD_INFORMATION_CLASS ThreadInformationClass,
       _Out_writes_bytes_       ThreadInformation,
  _In_ DWORD                    ThreadInformationSize
);

Parameters

hThread [in]

A handle to the thread. The handle must have THREAD_QUERY_INFORMATION access rights. For more information, see Thread Security and Access Rights.

ThreadInformationClass [in]

The class of information to retrieve. The only supported values are ThreadMemoryPriority and ThreadPowerThrottling.

ThreadInformation

Pointer to a structure to receive the type of information specified by the ThreadInformationClass parameter.

If the ThreadInformationClass parameter is ThreadMemoryPriority, this parameter must point to a MEMORY_PRIORITY_INFORMATION structure.

If the ThreadInformationClass parameter is ThreadPowerThrottling, this parameter must point to a THREAD_POWER_THROTTLING_STATE structure.

ThreadInformationSize [in]

The size in bytes of the structure specified by the ThreadInformation parameter.

If the ThreadInformationClass parameter is ThreadMemoryPriority, this parameter must be sizeof(MEMORY_PRIORITY_INFORMATION).

If the ThreadInformationClass parameter is ThreadPowerThrottling, this parameter must be sizeof(THREAD_POWER_THROTTLING_STATE).

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Examples

    DWORD ErrorCode;
    BOOL Success;
    MEMORY_PRIORITY_INFORMATION MemPrio;

    //
    // Query thread memory priority.
    //

    Success = GetThreadInformation(GetCurrentThread(),
                                   ThreadMemoryPriority,
                                   &MemPrio,
                                   sizeof(MemPrio));

    if (!Success) {
        ErrorCode = GetLastError();
        fprintf(stderr, "Get thread memory priority failed: %d\n", ErrorCode);
    } else {
        printf("Current thread memory priority is %d.\n", MemPrio.MemoryPriority);
    }

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

WinBase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

GetProcessInformation
SetThreadInformation

 

 

Show:
© 2017 Microsoft