Thread​Pool Thread​Pool Thread​Pool Class

Definition

public : static class ThreadPoolpublic static class ThreadPoolPublic Static Class ThreadPool
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

The ThreadPool class has only static methods, so its methods can be called without creating an instance of the class.

Methods

RunAsync(WorkItemHandler) RunAsync(WorkItemHandler) RunAsync(WorkItemHandler)

Creates a work item.

public : static IAsyncAction RunAsync(WorkItemHandler handler)public static IAsyncAction RunAsync(WorkItemHandler handler)Public Static Function RunAsync(handler As WorkItemHandler) As IAsyncAction
Parameters
handler
WorkItemHandler WorkItemHandler WorkItemHandler

The method to call when a thread becomes available to run the work item.

Returns

An IAsyncAction interface that provides access to the work item.

Attributes
See Also

RunAsync(WorkItemHandler, WorkItemPriority) RunAsync(WorkItemHandler, WorkItemPriority) RunAsync(WorkItemHandler, WorkItemPriority)

Creates a work item and specifies its priority relative to other work items in the thread pool.

public : static IAsyncAction RunAsync(WorkItemHandler handler, WorkItemPriority priority)public static IAsyncAction RunAsync(WorkItemHandler handler, WorkItemPriority priority)Public Static Function RunAsync(handler As WorkItemHandler, priority As WorkItemPriority) As IAsyncAction
Parameters
handler
WorkItemHandler WorkItemHandler WorkItemHandler

The method to call when a thread becomes available to run the work item.

priority
WorkItemPriority WorkItemPriority WorkItemPriority

The priority of the work item relative to other work items in the thread pool. The value of this parameter can be Low, Normal, or High.

Returns

An IAsyncAction interface that provides access to the work item.

Attributes
See Also

RunAsync(WorkItemHandler, WorkItemPriority, WorkItemOptions) RunAsync(WorkItemHandler, WorkItemPriority, WorkItemOptions) RunAsync(WorkItemHandler, WorkItemPriority, WorkItemOptions)

Creates a work item, specifies its priority relative to other work items in the thread pool, and specifies how long-running work items should be run.

public : static IAsyncAction RunAsync(WorkItemHandler handler, WorkItemPriority priority, WorkItemOptions options)public static IAsyncAction RunAsync(WorkItemHandler handler, WorkItemPriority priority, WorkItemOptions options)Public Static Function RunAsync(handler As WorkItemHandler, priority As WorkItemPriority, options As WorkItemOptions) As IAsyncAction
Parameters
handler
WorkItemHandler WorkItemHandler WorkItemHandler

The method to call when a thread becomes available to run the work item.

priority
WorkItemPriority WorkItemPriority WorkItemPriority

The priority of the work item relative to other work items in the thread pool.

options
WorkItemOptions WorkItemOptions WorkItemOptions

If this parameter is TimeSliced, the work item runs simultaneously with other time-sliced work items with each work item receiving a share of processor time. If this parameter is None, the work item runs when a worker thread becomes available.

Returns

An IAsyncAction interface that provides access to the work item.

Attributes
See Also