CreateUmsThreadContext function (winbase.h)

Creates a user-mode scheduling (UMS) thread context to represent a 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 CreateUmsThreadContext(
  [out] PUMS_CONTEXT *lpUmsThread
);

Parameters

[out] lpUmsThread

A PUMS_CONTEXT variable. On output, this parameter receives a pointer to a UMS thread context.

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_NOT_ENOUGH_MEMORY
Not enough memory is available to create the UMS thread context.

Remarks

A UMS thread context represents the state of a UMS worker thread. Thread contexts are used to specify UMS worker threads in function calls.

A UMS worker thread is created by calling the CreateRemoteThreadEx function after using InitializeProcThreadAttributeList and UpdateProcThreadAttribute to prepare a list of UMS attributes for the thread.

The underlying structures for a UMS thread context are managed by the system and should not be modified directly. To get and set information about a UMS worker thread, use the QueryUmsThreadInformation and SetUmsThreadInformation functions.

After a UMS worker thread terminates, its thread context should be released by calling DeleteUmsThreadContext.

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

CreateRemoteThreadEx

DeleteUmsThreadContext

InitializeProcThreadAttributeList

QueryUmsThreadInformation

SetUmsThreadInformation

UpdateProcThreadAttribute