forked from ShuriZma/suyu
1
0
Fork 0

Common/Fiber: Additional corrections to f_context.

This commit is contained in:
Fernando Sahmkow 2020-02-26 17:34:23 -04:00
parent 7d2b1a6ec4
commit 41013381d6
1 changed files with 4 additions and 4 deletions

View File

@ -81,7 +81,7 @@ std::shared_ptr<Fiber> Fiber::ThreadToFiber() {
}
#else
constexpr std::size_t default_stack_size = 1024 * 1024; // 4MB
constexpr std::size_t default_stack_size = 1024 * 1024; // 1MB
struct Fiber::FiberImpl {
alignas(64) std::array<u8, default_stack_size> stack;
@ -106,10 +106,10 @@ Fiber::Fiber(std::function<void(void*)>&& entry_point_func, void* start_paramete
: guard{}, entry_point{std::move(entry_point_func)}, start_parameter{start_parameter},
previous_fiber{} {
impl = std::make_unique<FiberImpl>();
void* stack_start =
static_cast<void*>(static_cast<std::uintptr_t>(impl->stack.data()) + default_stack_size);
u8* stack_limit = impl->stack.data();
u8* stack_base = stack_limit + default_stack_size;
impl->context =
boost::context::detail::make_fcontext(stack_start, impl->stack.size(), FiberStartFunc);
boost::context::detail::make_fcontext(stack_base, impl->stack.size(), FiberStartFunc);
}
Fiber::Fiber() {