System::Threading::Tasks::Run method

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

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)
ParameterTypeDescription
actionconst Action<>&The work to execute asynchronously.

ReturnValue

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

See Also

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

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)
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.

ReturnValue

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

See Also

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

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)
ParameterTypeDescription
functionconst Func<TaskPtr>&The work to execute asynchronously, which returns a Task.

ReturnValue

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

See Also

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

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)
ParameterDescription
TResultThe type of the result returned by the task.
ParameterTypeDescription
functionconst Func<TResult>&The work to execute asynchronously.

ReturnValue

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

See Also