ThreadPool Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides 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 UWP apps.
public ref class ThreadPool abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class ThreadPool final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public static class ThreadPool
Public Class ThreadPool
- Inheritance
- Attributes
Windows requirements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
Remarks
The ThreadPool class has only static methods, so its methods can be called without creating an instance of the class.
Methods
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. |
RunAsync(WorkItemHandler, WorkItemPriority) |
Creates a work item and specifies its priority relative to other work items in the thread pool. |
RunAsync(WorkItemHandler) |
Creates a work item. |