SetUmsThreadInformation function (winbase.h)

Sets application-specific context information for the specified user-mode scheduling (UMS) worker thread.

Warning

As of Windows 11, user-mode scheduling is not supported. All calls fail with the error ERROR_NOT_SUPPORTED.

Syntax

BOOL SetUmsThreadInformation(
  [in] PUMS_CONTEXT          UmsThread,
  [in] UMS_THREAD_INFO_CLASS UmsThreadInfoClass,
  [in] PVOID                 UmsThreadInformation,
  [in] ULONG                 UmsThreadInformationLength
);

Parameters

[in] UmsThread

A pointer to a UMS thread context.

[in] UmsThreadInfoClass

A UMS_THREAD_INFO_CLASS value that specifies the kind of information to set. This parameter must be UmsThreadUserContext.

[in] UmsThreadInformation

A pointer to a buffer that contains the information to set.

[in] UmsThreadInformationLength

The size of the UmsThreadInformation buffer, in bytes.

Return value

If the function succeeds, it returns a nonzero value.

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

Return code Description
ERROR_INFO_LENGTH_MISMATCH
The buffer size does not match the required size for the specified information class.
ERROR_INVALID_INFO_CLASS
The UmsThreadInfoClass parameter specifies an information class that is not supported.
ERROR_NOT_SUPPORTED
UMS is not supported.

Remarks

The SetUmsThreadInformation function can be used to set an application-defined context for the specified UMS worker thread. The context information can consist of anything the application might find useful to track, such as per-scheduler or per-worker thread state. The underlying structures for UMS worker threads are managed by the system and should not be modified directly.

The QueryUmsThreadInformation function can be used to retrieve other exposed information about the specified thread, such as its thread execution block (TEB) and whether the thread is suspended or terminated. Information that is not exposed through QueryUmsThreadInformation should be considered reserved.

Requirements

Requirement Value
Minimum supported client Windows 7 (64-bit only) [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header winbase.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll
API set api-ms-win-core-ums-l1-1-0 (introduced in Windows 7)

See also

QueryUmsThreadInformation