task::then 메서드
이 작업에 연속 작업을 추가합니다.
template<
typename _Function
>
__declspec(
noinline
) auto then(const _Function& _Func) const -> typename details::_ContinuationTypeTraits<_Function, _ReturnType>::_TaskOfType;
template<
typename _Function
>
__declspec(
noinline
) auto then(const _Function& _Func, const task_options& _TaskOptions) const -> typename details::_ContinuationTypeTraits<_Function, _ReturnType>::_TaskOfType;
template<
typename _Function
>
__declspec(
noinline
) auto then(const _Function& _Func, cancellation_token _CancellationToken, task_continuation_context _ContinuationContext) const -> typename details::_ContinuationTypeTraits<_Function, _ReturnType>::_TaskOfType;
template<
typename _Function
>
__declspec(
noinline
) auto then(const _Function& _Func, const task_options& _TaskOptions = task_options()) const -> typename details::_ContinuationTypeTraits<_Function, void>::_TaskOfType;
template<
typename _Function
>
__declspec(
noinline
) auto then(const _Function& _Func, cancellation_token _CancellationToken, task_continuation_context _ContinuationContext) const -> typename details::_ContinuationTypeTraits<_Function, void>::_TaskOfType;
매개 변수
_Function
이 작업으로 호출될 함수 개체의 형식입니다._Func
이 작업이 완료될 때 실행되는 연속 함수입니다. 이 연속 함수는 result_type 또는 **task<result_type>**을 입력 변수로 사용해야 하며, 여기서 result_type은 이 작업에서 생성하는 결과의 형식입니다._TaskOptions
작업 옵션에는 취소 토큰, 스케줄러 및 연속 컨텍스트가 포함됩니다. 기본적으로 앞의 세 가지 옵션은 선행 작업에서 상속됩니다._CancellationToken
연속 작업에 연결할 취소 토큰입니다. 취소 토큰 없이 만든 연속 작업은 선행 작업의 토큰을 상속합니다._ContinuationContext
연속이 실행되어야 하는 위치를 지정하는 변수입니다. 이 변수는 Windows 스토어 스타일 응용 프로그램에서 사용할 경우에만 유용합니다. 자세한 내용은 task_continuation_context를 참조하십시오.
반환 값
새로 만든 연속 작업입니다. 반환된 작업의 결과 형식은 _Func가 반환하는 것에 따라 결정됩니다.
설명
Windows::Foundation::IAsyncInfo 인터페이스를 반환하는 람다 또는 구조 함수를 사용하는 then의 오버로드는 Windows 스토어 응용 프로그램에서만 사용할 수 있습니다.
작업 연속을 사용하여 비동기 작업을 작성하는 방법에 대한 자세한 내용은 작업 병렬 처리(동시성 런타임)를 참조하십시오.
요구 사항
헤더: ppltasks.h
네임스페이스: 동시성