PreallocatedWorkItem class

Applies to Windows and Windows Phone

A preallocated work item is constructed in advance of its submission to the thread pool, ensuring that the work item is constructed so that it can be submitted to the thread pool when necessary. For example, a PreallocatedWorkItem can be created in case it is needed for a resource deallocation routine, since the resource deallocation routine may be called in circumstances when not enough resources would be available to create the work item.

Note  The ThreadPool API is supported for desktop as well as Windows Store apps.

Syntax

Public NotInheritable Class PreallocatedWorkItem

Attributes

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]
[WebHostHidden()]

Members

The PreallocatedWorkItem class has these types of members:

Constructors

The PreallocatedWorkItem class has these constructors.

ConstructorDescription
PreallocatedWorkItem(WorkItemHandler) Initializes a new work item with a WorkItemHandler delegate, allocating resources for the work item in advance.
PreallocatedWorkItem(WorkItemHandler, WorkItemPriority) Initializes a new work item with a WorkItemHandler delegate, allocating resources for the work item in advance, and specifies the priority of the work item relative to other work items in the thread pool.
PreallocatedWorkItem(WorkItemHandler, WorkItemPriority, WorkItemOptions) Initializes a new work item with a WorkItemHandler delegate, allocating resources for the work item in advance, and specifies the priority of the work item relative to other work items in the thread pool. Also specifies how the thread pool will allocate processor time for the work item.

 

Methods

The PreallocatedWorkItem class has these methods. It also inherits methods from the Object class.

MethodDescription
RunAsync Submits the preallocated work item to the thread pool, without requiring any additional resources to be allocated.

 

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8

Namespace

Windows.System.Threading.Core
Windows::System::Threading::Core [C++]

Metadata

Windows.winmd

See also

Object

 

 

Show:
© 2014 Microsoft