Skip to content

Commit

Permalink
修复fiber创建时堆栈大小的
Browse files Browse the repository at this point in the history
  • Loading branch information
yyzybb537 committed Jan 27, 2016
1 parent 78ec7cc commit e33bb26
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ctx_win_fiber/context.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <context.h>
#include <scheduler.h>
#include <Windows.h>
#include <algorithm>

namespace co
{
Expand Down Expand Up @@ -48,8 +49,9 @@ namespace co
bool Context::Init(std::function<void()> const& fn, char* shared_stack, uint32_t shared_stack_cap)
{
impl_->fn_ = fn;
impl_->native_ = CreateFiberEx(g_Scheduler.GetOptions().init_commit_stack_size,
stack_size_, FIBER_FLAG_FLOAT_SWITCH,
SIZE_T commit_size = g_Scheduler.GetOptions().init_commit_stack_size;
impl_->native_ = CreateFiberEx(commit_size,
(std::max)(stack_size_, commit_size), FIBER_FLAG_FLOAT_SWITCH,
(LPFIBER_START_ROUTINE)FiberFunc, &impl_->fn_);
return !!impl_->native_;
}
Expand Down

0 comments on commit e33bb26

Please sign in to comment.