UmsSchedulerProc callback function
The application-defined user-mode scheduling (UMS) scheduler entry point function associated with a UMS completion list.
The PUMS_SCHEDULER_ENTRY_POINT type defines a pointer to this function. UmsSchedulerProc is a placeholder for the application-defined function name.
VOID UmsSchedulerProc( _In_ UMS_SCHEDULER_REASON Reason, _In_ ULONG_PTR ActivationPayload, _In_ PVOID SchedulerParam );
- Reason [in]
The reason the scheduler entry point is being called. This parameter can be one of the following values.
A UMS scheduler thread was created. The entry point is called with this reason once each time EnterUmsSchedulingMode is called.
A UMS worker thread blocked.
An executing UMS worker thread yielded control by calling the UmsThreadYield function.
- ActivationPayload [in]
If the Reason parameter is UmsSchedulerStartup, this parameter is NULL.
If the Reason parameter is UmsSchedulerThreadBlocked, bit 0 of this parameter indicates the type of activity that was being serviced when the UMS worker thread blocked.
The thread blocked on a trap (for example, a hard page fault) or an interrupt (for example, an asynchronous procedure call).
The thread blocked on a system call.
If the Reason parameter is UmsSchedulerThreadYield, this parameter is a pointer to the UMS thread context of the UMS worker thread that yielded.
- SchedulerParam [in]
If the Reason parameter is UmsSchedulerStartup, this parameter is the SchedulerParam member of the UMS_SCHEDULER_STARTUP_INFO structure passed to the EnterUmsSchedulingMode function that triggered the entry point call.
If the Reason parameter is UmsSchedulerThreadYield this parameter is the SchedulerParam parameter passed to the UmsThreadYield function that triggered the entry point call.
If the Reason parameter is UmsSchedulerThreadBlocked, this parameter is NULL.
This function does not return a value.
The UmsSchedulerProc function pointer type is defined as PUMS_SCHEDULER_ENTRY_POINT in WinBase.h. The underlying function type is defined as RTL_UMS_SCHEDULER_ENTRY_POINT in WinNT.h
Each UMS scheduler thread has an associated UmsSchedulerProc entry point function that is specified when the thread calls the EnterUmsSchedulingMode function. The system calls the scheduler entry point function with a reason of UmsSchedulerStartup when the scheduler thread is converted for UMS.
Subsequently, when a UMS worker thread that is running on the scheduler thread yields or blocks, the system calls the scheduler thread's entry point function with a pointer to the UMS thread context of the worker thread.
The application's scheduler is responsible for selecting the next UMS worker thread to run. The scheduler implements all policies that influence execution of its UMS threads, including processor affinity and thread priority. For example, a scheduler might give priority to I/O-intensive threads, or it might run threads on a first-come, first-served basis. This logic can be implemented in the scheduler entry point function or elsewhere in the application.
When a blocked UMS worker thread becomes unblocked, the system queues the unblocked thread to the associated completion list and signals the completion list event. To retrieve UMS worker threads from the completion list, use the DequeueUmsCompletionListItems function.
Minimum supported client
|Windows 7 (64-bit only) [desktop apps only]|
Minimum supported server
|Windows Server 2008 R2 [desktop apps only]|