task::then-Methode

Fügt eine Fortsetzungsaufgabe dieser Aufgabe hinzu.

template<
   typename _Function
>
auto then(
   const _Function& _Func
) const -> typename details::_ContinuationTypeTraits<_Function, _ReturnType>::_TaskOfType;

template<
   typename _Function
>
auto then(
   const _Function& _Func,
   cancellation_token _CancellationToken
) const -> typename details::_ContinuationTypeTraits<_Function, _ReturnType>::_TaskOfType;

template<
   typename _Function
>
auto then(
   const _Function& _Func,
   task_continuation_context _ContinuationContext
) const -> typename details::_ContinuationTypeTraits<_Function, _ReturnType>::_TaskOfType;

template<
   typename _Function
>
auto then(
   const _Function& _Func,
   cancellation_token _CancellationToken,
   task_continuation_context _ContinuationContext
) const -> typename details::_ContinuationTypeTraits<_Function, _ReturnType>::_TaskOfType;

template<
   typename _Function
>
auto then(
   const _Function& _Func
) const -> typename details::_ContinuationTypeTraits<_Function, void>::_TaskOfType;

template<
   typename _Function
>
auto then(
   const _Function& _Func,
   cancellation_token _CancellationToken
) const -> typename details::_ContinuationTypeTraits<_Function, void>::_TaskOfType;

template<
   typename _Function
>
auto then(
   const _Function& _Func,
   task_continuation_context _ContinuationContext
) const -> typename details::_ContinuationTypeTraits<_Function, void>::_TaskOfType;

template<
   typename _Function
>
auto then(
   const _Function& _Func,
   cancellation_token _CancellationToken,
   task_continuation_context _ContinuationContext
) const -> typename details::_ContinuationTypeTraits<_Function, void>::_TaskOfType;

Parameter

  • _Function
    Der Typ des Funktionsobjekts, das von dieser Aufgabe aufgerufen wird.

  • _Func
    Die Fortsetzungsfunktion, um ausführen, wenn diese Aufgabe ausführt.Diese Fortsetzungsfunktion muss als Eingabe eine Variable von entweder result_type akzeptieren, oder task<result_type>, in dem result_type der Typ des Ergebnisses dieser Aufgabe ist, erzeugt.

  • _CancellationToken
    Das mit der Fortsetzungsaufgabe Abbruchtoken, zuzuordnen.Eine Fortsetzungsaufgabe, die ohne ein Abbruchtoken erstellt wird, erbt das Token der Vorgängeraufgabe.

  • _ContinuationContext
    Eine Variable, die angibt, wo die Fortsetzung ausführen soll.Diese Variable ist nur hilfreich, wenn sie in einer Windows Store-App verwendet wird.Weitere Informationen finden Sie unter task_continuation_context

Rückgabewert

Die neu erstellte Fortsetzungsaufgabe.Der Ergebnistyp der zurückgegebenen Aufgabe wird durch bestimmt, was _Func zurückgibt.

Hinweise

Eine Fortsetzungsaufgabe (auch kurz als Fortsetzung bezeichnet) ist eine asynchrone Aufgabe, die von einer anderen Aufgabe aufgerufen wird, die als Vorgänger bezeichnet, wenn der Vorgänger abgeschlossen.Weitere Informationen zu Fortsetzungen und verwenden, um asynchrone Arbeit zusammensetzt, finden Sie unter Fortsetzungs-Aufgaben im Dokument Aufgabenparallelität (Concurrency Runtime).

Überladungen von then, das ein Lambda akzeptieren, oder Funktionselement zurückgeben Windows::Foundation::IAsyncInfo, das, zu Windows Store-App nur verfügbar sind.

Anforderungen

Header: ppltasks.h

Namespace: Parallelität

Siehe auch

Referenz

task-Klasse (Concurrency Runtime)