QFutureSynchronizer Class
template <typename T> class QFutureSynchronizerQFutureSynchronizer 클래스는 QFuture 동기화를 간소화해 주는 편의 클래스입니다. 더 보기...
| 헤더: | #include <QFutureSynchronizer> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
| qmake: | QT += core |
- 상속된 멤버를 포함한 모든 멤버 목록
- QFutureSynchronizer는 스레딩 클래스의 일부입니다.
공개 함수
| QFutureSynchronizer() | |
| QFutureSynchronizer(QFuture<T> future) | |
| ~QFutureSynchronizer() | |
| void | addFuture(QFuture<T> future) |
| bool | cancelOnWait() const |
| void | clearFutures() |
| QList<QFuture<T>> | futures() const |
| void | setCancelOnWait(bool enabled) |
| void | setFuture(QFuture<T> future) |
| void | waitForFinished() |
상세 설명
QFutureSynchronizer는 템플릿 매개변수 T 가 동기화되는 QFuture 객체의 결과 유형을 지정하는 템플릿 클래스입니다. QFutureSynchronizer는 하나 이상의 QFuture 객체의 동기화를 단순화합니다. 퓨처는 addFuture() 또는 setFuture() 함수를 사용하여 추가됩니다. futures() 함수는 퓨처 목록을 반환합니다. clearFutures()를 사용하여 QFutureSynchronizer에서 모든 퓨처를 제거할 수 있습니다.
waitForFinished() 함수는 모든 퓨처가 완료될 때까지 대기합니다. QFutureSynchronizer의 소멸자는 waitForFinished()를 호출하므로, 함수에서 반환되기 전에 모든 퓨처가 완료되었는지 쉽게 확인할 수 있습니다:
void someFunction()
{
QFutureSynchronizer<void> synchronizer;
//...
synchronizer.addFuture(QtConcurrent::run(anotherFunction));
synchronizer.addFuture(QtConcurrent::map(list, mapFunction));
return; // QFutureSynchronizer waits for all futures to finish
}waitForFinished()의 동작은 setCancelOnWait() 함수를 사용하여 변경할 수 있습니다. setCancelOnWait(true)를 호출하면 waitForFinished()는 모든 퓨처가 완료될 때까지 대기하기 전에 이를 모두 취소합니다. cancelOnWait() 함수를 사용하여 cancel-on-wait 기능의 상태를 조회할 수 있습니다.
QFuture, QFutureWatcher 및 Qt Concurrent.
멤버 함수 문서
QFutureSynchronizer::QFutureSynchronizer()
QFutureSynchronizer 객체를 생성합니다.
[explicit] QFutureSynchronizer::QFutureSynchronizer(QFuture<T> future)
QFutureSynchronizer 객체를 생성하고, addFuture()를 호출하여 future 에 대한 감시를 시작합니다.
addFuture()도 참조하십시오 .
QFutureSynchronizer::~QFutureSynchronizer()
이 QFutureSynchronizer 객체를 소멸시키기 전에 모든 퓨처가 완료되었는지 확인하기 위해 waitForFinished() 함수를 호출합니다.
waitForFinished()도 참조하십시오 .
void QFutureSynchronizer::addFuture(QFuture<T> future)
future 를 관리형 선물 목록에 추가합니다.
futures()도 참조하십시오 .
bool QFutureSynchronizer::cancelOnWait() const
'cancel-on-wait' 기능이 활성화되어 있으면 ` true `를 반환하고, 그렇지 않으면 `false`를 반환합니다. 'cancel-on-wait'가 활성화되어 있는 경우, ` waitForFinished()` 함수는 퓨처가 완료될 때까지 기다리지 않고 모든 퓨처를 취소합니다.
setCancelOnWait() 및 waitForFinished()도 참조하십시오 .
void QFutureSynchronizer::clearFutures()
이 QFutureSynchronizer 에서 모든 관리형 선물 상품을 제거합니다.
addFuture() 및 setFuture()도 참조하십시오 .
QList<QFuture<T>> QFutureSynchronizer::futures() const
모든 관리형 선물 목록을 반환합니다.
addFuture() 및 setFuture()도 참조하십시오 .
void QFutureSynchronizer::setCancelOnWait(bool enabled)
enabled 인수를 기반으로 대기 시 취소 기능을 활성화하거나 비활성화합니다. enabled 가 true인 경우, waitForFinished() 함수는 퓨처가 완료될 때까지 기다리지 않고 모든 퓨처를 취소합니다.
cancelOnWait() 및 waitForFinished()도 참조하십시오 .
void QFutureSynchronizer::setFuture(QFuture<T> future)
future 를 이 QFutureSynchronizer 가 관리하는 유일한 퓨처로 설정합니다. 이 함수는 waitForFinished()를 호출한 다음, clearFutures()를 호출하고, 마지막으로 future 를 addFuture()에 전달하는 편의 함수입니다.
addFuture(), waitForFinished(), clearFutures()도 참조하십시오 .
void QFutureSynchronizer::waitForFinished()
모든 퓨처가 완료될 때까지 기다립니다. cancelOnWait()가 true 를 반환하면, 각 퓨처가 완료되기를 기다리기 전에 모두 취소됩니다.
cancelOnWait() 및 setCancelOnWait()도 참조하십시오 .
© 2026 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.