Call std::terminate if await_* are called on NonViral*Invoker

This commit is contained in:
2026-05-17 17:11:43 -04:00
parent ad4ea3ccac
commit 0dcfa754b6
+4 -16
View File
@@ -3,6 +3,7 @@
#include <config.h> #include <config.h>
#include <coroutine> #include <coroutine>
#include <exception>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <stdexcept> #include <stdexcept>
@@ -59,26 +60,13 @@ struct NonViralNonSuspendingInvoker
using PostingInvoker<PostingPromiseTemplate<void>, void>::PostingInvoker; using PostingInvoker<PostingPromiseTemplate<void>, void>::PostingInvoker;
bool await_ready() const noexcept bool await_ready() const noexcept
{ { std::terminate(); }
#ifdef CONFIG_LIBSSCL_DEBUG_CO
std::cout << __func__ << ": " << std::this_thread::get_id() << " This shouldn't be called.\n";
#endif
return true;
}
void await_suspend(std::coroutine_handle<NonViralNonSuspendingInvoker<PostingPromiseTemplate>>) noexcept void await_suspend(std::coroutine_handle<NonViralNonSuspendingInvoker<PostingPromiseTemplate>>) noexcept
{ { std::terminate(); }
#ifdef CONFIG_LIBSSCL_DEBUG_CO
std::cout << __func__ << ": " << std::this_thread::get_id() << " This shouldn't be called.\n";
#endif
}
void await_resume() noexcept void await_resume() noexcept
{ { std::terminate(); }
#ifdef CONFIG_LIBSSCL_DEBUG_CO
std::cout << __func__ << ": " << std::this_thread::get_id() << " This shouldn't be called.\n";
#endif
}
}; };
/** Viral awaitable: promise_type inherits PostingPromiseTemplate<T> (posting /** Viral awaitable: promise_type inherits PostingPromiseTemplate<T> (posting