Run()

System::Threading::Tasks::Run(const Action<>&) function

Queues the specified work to run on the thread pool and returns a Task handle for that work.

TaskPtr System::Threading::Tasks::Run(const Action<> &action)

Arguments

ParameterTypeDescription
actionconst Action<>&The work to execute asynchronously.

Return Value

A Task that represents the work queued to execute in the thread pool.

System::Threading::Tasks::Run(const Action<>&, const CancellationToken&) function

Queues the specified work to run on the thread pool and returns a Task handle for that work.

TaskPtr System::Threading::Tasks::Run(const Action<> &action, const CancellationToken &cancellationToken)

Arguments

ParameterTypeDescription
actionconst Action<>&The work to execute asynchronously.
cancellationTokenconst CancellationToken&A cancellation token that can be used to cancel the work if it has not yet started.

Return Value

A Task that represents the work queued to execute in the thread pool.

System::Threading::Tasks::Run(const Func<TaskPtr>&) function

Queues the specified work to run on the thread pool and returns a proxy for the Task returned by the function.

TaskPtr System::Threading::Tasks::Run(const Func<TaskPtr> &function)

Arguments

ParameterTypeDescription
functionconst Func<TaskPtr>&The work to execute asynchronously, which returns a Task.

Return Value

A Task that represents a proxy for the Task returned by the function.

System::Threading::Tasks::Run(const Func<TResult>&) function

Queues the specified work to run on the thread pool and returns a Task handle for that work.

template<typename TResult> RTaskPtr<TResult> System::Threading::Tasks::Run(const Func<TResult> &function)

Template parameters

ParameterDescription
TResultThe type of the result returned by the task.

Arguments

ParameterTypeDescription
functionconst Func<TResult>&The work to execute asynchronously.

Return Value

A Task that represents the work queued to execute in the thread pool.

See Also