Sdílet prostřednictvím


ThreadPool.RunAsync Method

Definition

Overloads

RunAsync(WorkItemHandler)

Creates a work item.

RunAsync(WorkItemHandler, WorkItemPriority)

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

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)

Creates a work item.

public:
 static IAsyncAction ^ RunAsync(WorkItemHandler ^ handler);
/// [Windows.Foundation.Metadata.Overload("RunAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncAction RunAsync(WorkItemHandler const& handler);
[Windows.Foundation.Metadata.Overload("RunAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncAction RunAsync(WorkItemHandler handler);
function runAsync(handler)
Public Shared Function RunAsync (handler As WorkItemHandler) As IAsyncAction

Parameters

handler
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

Applies to

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);
/// [Windows.Foundation.Metadata.Overload("RunWithPriorityAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncAction RunAsync(WorkItemHandler const& handler, WorkItemPriority const& priority);
[Windows.Foundation.Metadata.Overload("RunWithPriorityAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncAction RunAsync(WorkItemHandler handler, WorkItemPriority priority);
function runAsync(handler, priority)
Public Shared Function RunAsync (handler As WorkItemHandler, priority As WorkItemPriority) As IAsyncAction

Parameters

handler
WorkItemHandler

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

priority
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

Applies to

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);
/// [Windows.Foundation.Metadata.Overload("RunWithPriorityAndOptionsAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncAction RunAsync(WorkItemHandler const& handler, WorkItemPriority const& priority, WorkItemOptions const& options);
[Windows.Foundation.Metadata.Overload("RunWithPriorityAndOptionsAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncAction RunAsync(WorkItemHandler handler, WorkItemPriority priority, WorkItemOptions options);
function runAsync(handler, priority, options)
Public Shared Function RunAsync (handler As WorkItemHandler, priority As WorkItemPriority, options As WorkItemOptions) As IAsyncAction

Parameters

handler
WorkItemHandler

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

priority
WorkItemPriority

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

options
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

Applies to