7#include <Cutelyst/async.h>
34 std::coroutine_handle<promise_type> handle;
35 std::vector<QMetaObject::Connection> connections;
39 for (
auto &conn : connections) {
40 QObject::disconnect(conn);
45 void return_void()
noexcept {}
49 handle = std::coroutine_handle<promise_type>::from_promise(*
this);
53 std::suspend_never initial_suspend()
const noexcept {
return {}; }
54 std::suspend_never final_suspend()
noexcept {
return {}; }
55 void unhandled_exception() {}
57 bool await_ready()
const noexcept {
return false; }
59 std::suspend_never yield_value(QObject *obj)
67 ASync a(qobject_cast<Cutelyst::Context *>(obj));
69 auto conn = QObject::connect(obj, &QObject::destroyed, [
this, a](QObject *obj) {
76 connections.emplace_back(std::move(conn));
79 void await_suspend(std::coroutine_handle<> h)
noexcept {}
80 void await_resume()
const noexcept {}
Helper class for asynchronous processing.
The Cutelyst namespace holds all public Cutelyst API.