QTaskBuilder Class

template <typename Task, typename... Args> class QtConcurrent::QTaskBuilder

QTaskBuilder 클래스는 작업 매개변수를 조정하는 데 사용됩니다. 더 보기...

헤더: #include <QTaskBuilder>
CMake: find_package(Qt6 REQUIRED COMPONENTS Concurrent)
target_link_libraries(mytarget PRIVATE Qt6::Concurrent)
qmake: QT += concurrent
이후: Qt 6.0

공용 함수

QtConcurrent::QTaskBuilder<Task, Args...> &onThreadPool(QThreadPool &newThreadPool)
QFuture<QtConcurrent::InvokeResultType> spawn()
void spawn(QtConcurrent::FutureResult)
QtConcurrent::QTaskBuilder<Task, ExtraArgs...> withArguments(ExtraArgs &&... args)
QtConcurrent::QTaskBuilder<Task, Args...> &withPriority(int newPriority)

자세한 설명

이 클래스의 객체는 수동으로 생성할 수 없습니다. 자세한 내용과 사용 예제는 동시 작업 문서를 참조하세요.

멤버 함수 문서

QtConcurrent::QTaskBuilder<Task, Args...> &QTaskBuilder::onThreadPool(QThreadPool &newThreadPool)

작업이 호출될 스레드 풀 newThreadPool 을 설정합니다.

QFuture<QtConcurrent::InvokeResultType> QTaskBuilder::spawn()

별도의 스레드에서 작업을 실행하고 미래의 객체를 즉시 반환합니다. 이것은 비차단 호출입니다. 작업이 즉시 시작되지 않을 수 있습니다.

void QTaskBuilder::spawn(QtConcurrent::FutureResult)

별도의 스레드에서 작업을 실행합니다. 이것은 비차단 호출입니다. 작업이 즉시 시작되지 않을 수 있습니다.

template <typename... ExtraArgs> QtConcurrent::QTaskBuilder<Task, ExtraArgs...> QTaskBuilder::withArguments(ExtraArgs &&... args)

태스크가 호출될 args 인수를 설정합니다. 코드가 잘못된 형식(컴파일 오류 발생)인 경우:

  • 이 함수가 두 번 이상 호출됩니다.
  • 인자 수는 0입니다.

QtConcurrent::QTaskBuilder<Task, Args...> &QTaskBuilder::withPriority(int newPriority)

작업이 호출될 우선순위 newPriority 를 설정합니다.

관련 비회원

[alias] InvokeResultType

이 유형의 단순화된 정의는 다음과 같습니다:

template <class Task, class ...Args>
using InvokeResultType = std::invoke_result_t<std::decay_t<Task>, std::decay_t<Args>...>;

실제 구현에는 지정된 인수를 사용하여 작업을 호출할 수 있는지 여부에 대한 컴파일 타임 검사도 포함되어 있습니다.

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.