8 #include <Cutelyst/async.h> 9 #include <Cutelyst/controller.h> 39 std::coroutine_handle<promise_type> handle;
40 std::vector<QMetaObject::Connection> connections;
44 for (
const auto &conn : connections) {
50 void return_void() noexcept {}
54 handle = std::coroutine_handle<promise_type>::from_promise(*
this);
58 std::suspend_never initial_suspend()
const noexcept {
return {}; }
59 std::suspend_never final_suspend() noexcept {
return {}; }
60 void unhandled_exception() {}
62 bool await_ready()
const noexcept {
return false; }
63 void await_suspend(std::coroutine_handle<> h) noexcept {}
64 void await_resume()
const noexcept
66 Q_ASSERT_X(!connections.empty(),
"Cutelyst::CoroContext",
"Did not yield any QObject*");
69 std::suspend_never yield_value(
const QObject *obj)
78 connections.emplace_back(std::move(conn));
84 trackContext(context);
90 template <
typename... ArgTypes>
94 trackContext(context);
97 template <
typename... ArgTypes>
100 trackContext(context);
103 void trackContext(
Context *context)
121 connections.emplace_back(std::move(conn));
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
Helper class for asynchronous processing.
bool isFinalized() const noexcept
The Cutelyst namespace holds all public Cutelyst API.
bool disconnect(const QMetaObject::Connection &connection)
Response * response() const noexcept
void destroyed(QObject *obj)