Skip to content

Commit

Permalink
Embedded the fiber start routine as lambda.
Browse files Browse the repository at this point in the history
  • Loading branch information
shin1m committed Nov 7, 2023
1 parent e900574 commit 81c2838
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
9 changes: 0 additions & 9 deletions include/xemmai/fiber.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ struct t_fiber
{
struct t_internal
{
#ifdef _WIN32
static void CALLBACK f_start(PVOID a_f)
{
t_object* bottom = nullptr;
v_current->v_stack_bottom = ⊥
reinterpret_cast<void(*)()>(a_f)();
}
#endif

t_internal* v_next;
void* v_thread;
t_fiber* v_fiber;
Expand Down
7 changes: 6 additions & 1 deletion src/fiber.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ t_fiber::t_internal::t_internal(t_fiber* a_fiber, void(*a_f)()) : t_internal(a_f
t_fiber::t_internal::t_internal(t_fiber* a_fiber, void(*a_f)()) : t_internal(a_fiber->v_stack, 2)
{
v_fiber = a_fiber;
v_handle = CreateFiber(0, f_start, a_f);
v_handle = CreateFiber(0, [](PVOID a_f)
{
t_object* bottom = nullptr;
v_current->v_stack_bottom = &bottom;
reinterpret_cast<void(*)()>(a_f)();
}, a_f);
}
#endif

Expand Down

0 comments on commit 81c2838

Please sign in to comment.