PreallocatedWorkItem.PreallocatedWorkItem(WorkItemHandler, WorkItemPriority, WorkItemOptions) constructor

Applies to Windows and Windows Phone

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.

Syntax


Public Sub New (
  handler As WorkItemHandler,  
  priority As WorkItemPriority,  
  options As WorkItemOptions 
)

Parameters

handler

Type: WorkItemHandler

Indicates the method that the preallocated work item will run.

priority

Type: 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.

options

Type: WorkItemOptions

If this parameter is set to 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 set to None, the work item runs when a worker thread becomes available.

Remarks

In C++, make sure that methods used as WorkItemHandler delegates exhibit agile threading model behavior. Calling a non-agile method from a work item will cause a deadlock to occur.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

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

Metadata

Windows.winmd

See also

PreallocatedWorkItem
PreallocatedWorkItem(WorkItemHandler)
PreallocatedWorkItem(WorkItemHandler, WorkItemPriority)

 

 

Show:
© 2014 Microsoft