EnterUmsSchedulingMode function (winbase.h)

Converts the calling thread into a user-mode scheduling (UMS) scheduler thread.

Warning

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

Syntax

BOOL EnterUmsSchedulingMode(
  [in] PUMS_SCHEDULER_STARTUP_INFO SchedulerStartupInfo
);

Parameters

[in] SchedulerStartupInfo

A pointer to a UMS_SCHEDULER_STARTUP_INFO structure that specifies UMS attributes for the thread, including a completion list and a UmsSchedulerProc entry point function.

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.

Remarks

An application's UMS scheduler creates one UMS scheduler thread for each processor that will be used to run UMS threads. The scheduler typically sets the affinity of the scheduler thread for a single processor, effectively reserving the processor for the use of that scheduler thread. For more information about thread affinity, see Multiple Processors.

When a UMS scheduler thread is created, the system calls the UmsSchedulerProc entry point function specified with the EnterUmsSchedulingMode function call. The application's scheduler is responsible for finishing any application-specific initialization of the scheduler thread and selecting a UMS worker thread to run.

The application's scheduler selects a UMS worker thread to run by calling ExecuteUmsThread with the worker thread's UMS thread context. The worker thread runs until it yields control by calling UmsThreadYield, blocks, or terminates. The scheduler thread is then available to run another worker thread.

A scheduler thread should continue to run until all of its worker threads reach a natural stopping point: that is, all worker threads have yielded, blocked, or terminated.

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

ExecuteUmsThread

Multiple Processors

UMS_SCHEDULER_STARTUP_INFO

UmsSchedulerProc

User-Mode Scheduling