diff --git a/ostd/internal/context.hh b/ostd/internal/context.hh index ab64f64..39f8b5c 100644 --- a/ostd/internal/context.hh +++ b/ostd/internal/context.hh @@ -41,15 +41,6 @@ transfer_t OSTD_CDECL ostd_ontop_fcontext( struct coroutine_context { protected: - struct forced_unwind { - fcontext_t ctx; - forced_unwind(fcontext_t c): ctx(c) {} - }; - - enum class state { - HOLD = 0, EXEC, TERM - }; - coroutine_context() {} coroutine_context(coroutine_context const &) = delete; @@ -132,17 +123,6 @@ protected: swap(p_sa, other.p_sa); } - template - void finish() { - set_dead(); - ostd_ontop_fcontext(p_orig, this, [](transfer_t t) -> transfer_t { - auto &self = *(static_cast(t.data)); - auto &sa = *(static_cast(self.p_sa)); - sa.deallocate(self.p_stack); - return { nullptr, nullptr }; - }); - } - template void make_context(SA &sa) { p_stack = sa.allocate(); @@ -159,6 +139,27 @@ protected: p_sa = new (sp) SA(std::move(sa)); } +private: + struct forced_unwind { + fcontext_t ctx; + forced_unwind(fcontext_t c): ctx(c) {} + }; + + enum class state { + HOLD = 0, EXEC, TERM + }; + + template + void finish() { + set_dead(); + ostd_ontop_fcontext(p_orig, this, [](transfer_t t) -> transfer_t { + auto &self = *(static_cast(t.data)); + auto &sa = *(static_cast(self.p_sa)); + sa.deallocate(self.p_stack); + return { nullptr, nullptr }; + }); + } + template static void context_call(detail::transfer_t t) { auto &self = *(static_cast(t.data));