summaryrefslogtreecommitdiffstats
path: root/src/httpserver/qhttpserverfutureresponse.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/httpserver/qhttpserverfutureresponse.cpp')
-rw-r--r--src/httpserver/qhttpserverfutureresponse.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/httpserver/qhttpserverfutureresponse.cpp b/src/httpserver/qhttpserverfutureresponse.cpp
index 3d2784b..2409e6a 100644
--- a/src/httpserver/qhttpserverfutureresponse.cpp
+++ b/src/httpserver/qhttpserverfutureresponse.cpp
@@ -61,6 +61,33 @@ QT_BEGIN_NAMESPACE
\endcode
*/
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+
+QHttpServerResponse QFutureInterface<QHttpServerResponse>::takeResult()
+{
+ if (isCanceled()) {
+ exceptionStore().throwPossibleException();
+ return QHttpServerResponse::StatusCode::NotFound;
+ }
+ // Note: we wait for all, this is intentional,
+ // not to mess with other unready results.
+ waitForResult(-1);
+
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
+ std::lock_guard<QMutex> locker{*mutex()};
+#else
+ std::lock_guard<QMutex> locker{mutex(0)};
+#endif
+ QtPrivate::ResultIteratorBase position = resultStoreBase().resultAt(0);
+ auto ret = std::move_if_noexcept(
+ *const_cast<QHttpServerResponse *>(position.pointer<QHttpServerResponse>()));
+ resultStoreBase().template clear<QHttpServerResponse>();
+
+ return ret;
+}
+
+#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+
struct QResponseWatcher : public QFutureWatcher<QHttpServerResponse>
{
Q_OBJECT