ThreadPool
ThreadPool
ThreadPool
ThreadPool
Class
Definition
Allows access to the thread pool. See Threading and async programming for detailed guidance on using the thread pool:
- Submit a work item to the thread pool
- Use a timer to submit a work item
- Create a periodic work item
- How to create and use pre-allocated work items
- Best practices for using the thread pool
- How to respond to named events and semaphores
- How to use functions as work item delegates > [!NOTE] > The ThreadPool API is supported for desktop as well as Windows Store apps.
public : static class ThreadPoolpublic static class ThreadPoolPublic Static Class ThreadPool// This API is not available in Javascript.
- Attributes
| 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) 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// This API is not available in Javascript.
The method to call when a thread becomes available to run the work item.
An IAsyncAction interface that provides access to the work item.
- See Also
RunAsync(WorkItemHandler, WorkItemPriority) 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// This API is not available in Javascript.
The method to call when a thread becomes available to run the work item.
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.
An IAsyncAction interface that provides access to the work item.
- See Also
RunAsync(WorkItemHandler, WorkItemPriority, WorkItemOptions) 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// This API is not available in Javascript.
The method to call when a thread becomes available to run the work item.
The priority of the work item relative to other work items in the thread pool.
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.
An IAsyncAction interface that provides access to the work item.
- See Also