forked from OctaForge/libostd
hide internal coroutine_context funcs from the rest
parent
f1341b913c
commit
c2b82771f9
|
@ -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<typename SA>
|
||||
void finish() {
|
||||
set_dead();
|
||||
ostd_ontop_fcontext(p_orig, this, [](transfer_t t) -> transfer_t {
|
||||
auto &self = *(static_cast<coroutine_context *>(t.data));
|
||||
auto &sa = *(static_cast<SA *>(self.p_sa));
|
||||
sa.deallocate(self.p_stack);
|
||||
return { nullptr, nullptr };
|
||||
});
|
||||
}
|
||||
|
||||
template<typename C, typename SA>
|
||||
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<typename SA>
|
||||
void finish() {
|
||||
set_dead();
|
||||
ostd_ontop_fcontext(p_orig, this, [](transfer_t t) -> transfer_t {
|
||||
auto &self = *(static_cast<coroutine_context *>(t.data));
|
||||
auto &sa = *(static_cast<SA *>(self.p_sa));
|
||||
sa.deallocate(self.p_stack);
|
||||
return { nullptr, nullptr };
|
||||
});
|
||||
}
|
||||
|
||||
template<typename C, typename SA>
|
||||
static void context_call(detail::transfer_t t) {
|
||||
auto &self = *(static_cast<C *>(t.data));
|
||||
|
|
Loading…
Reference in New Issue