Skip to content

Commit

Permalink
uasync: fix fcontext
Browse files Browse the repository at this point in the history
  • Loading branch information
microcai committed Dec 24, 2024
1 parent a04b30b commit 69d5e87
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion µasync/include/universal_fiber.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,10 @@ inline void process_overlapped_event(OVERLAPPED* _ov,
ovl_res->completekey = complete_key;
ovl_res->resultOk = resultOk;
#ifdef USE_FCONTEXT
auto old = __current_yield_fcontext;
auto coro_invoke_resume = jump_fcontext(ovl_res->resume_context, 0);
handle_fcontext_invoke(coro_invoke_resume);

__current_yield_fcontext = old;
#elif defined(USE_WINFIBER)
LPVOID old = __current_yield_fiber;
__current_yield_fiber = GetCurrentFiber();
Expand Down Expand Up @@ -554,8 +555,10 @@ inline void create_detached_coroutine(void (*func_ptr)(Args...), Args... args)

# if defined(USE_FCONTEXT)
auto new_fiber_resume_ctx = make_fcontext(&(new_fiber_ctx->func_ptr), sizeof(new_fiber_ctx->sp), __coroutine_entry_point<Args...>);
auto old = __current_yield_fcontext;
auto new_fiber_invoke_result = jump_fcontext(new_fiber_resume_ctx, new_fiber_ctx);
handle_fcontext_invoke(new_fiber_invoke_result);
__current_yield_fcontext = old;
# elif defined (USE_UCONTEXT)

ucontext_t self;
Expand Down

0 comments on commit 69d5e87

Please sign in to comment.