summaryrefslogtreecommitdiff
path: root/src/common/fiber.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/fiber.cpp')
-rw-r--r--src/common/fiber.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/common/fiber.cpp b/src/common/fiber.cpp
index e91d86dbe..a46be73c1 100644
--- a/src/common/fiber.cpp
+++ b/src/common/fiber.cpp
@@ -12,7 +12,6 @@
12 12
13namespace Common { 13namespace Common {
14 14
15
16#ifdef _MSC_VER 15#ifdef _MSC_VER
17 16
18struct Fiber::FiberImpl { 17struct Fiber::FiberImpl {
@@ -27,14 +26,14 @@ void Fiber::start() {
27 UNREACHABLE(); 26 UNREACHABLE();
28} 27}
29 28
30void __stdcall Fiber::FiberStartFunc(void* fiber_parameter) 29void __stdcall Fiber::FiberStartFunc(void* fiber_parameter) {
31{ 30 auto fiber = static_cast<Fiber*>(fiber_parameter);
32 auto fiber = static_cast<Fiber *>(fiber_parameter); 31 fiber->start();
33 fiber->start();
34} 32}
35 33
36Fiber::Fiber(std::function<void(void*)>&& entry_point_func, void* start_parameter) 34Fiber::Fiber(std::function<void(void*)>&& entry_point_func, void* start_parameter)
37 : guard{}, entry_point{std::move(entry_point_func)}, start_parameter{start_parameter}, previous_fiber{} { 35 : guard{}, entry_point{std::move(entry_point_func)}, start_parameter{start_parameter},
36 previous_fiber{} {
38 impl = std::make_unique<FiberImpl>(); 37 impl = std::make_unique<FiberImpl>();
39 impl->handle = CreateFiber(0, &FiberStartFunc, this); 38 impl->handle = CreateFiber(0, &FiberStartFunc, this);
40} 39}
@@ -99,14 +98,14 @@ void Fiber::start(boost::context::detail::transfer_t& transfer) {
99 UNREACHABLE(); 98 UNREACHABLE();
100} 99}
101 100
102void Fiber::FiberStartFunc(boost::context::detail::transfer_t transfer) 101void Fiber::FiberStartFunc(boost::context::detail::transfer_t transfer) {
103{ 102 auto fiber = static_cast<Fiber*>(transfer.data);
104 auto fiber = static_cast<Fiber *>(transfer.data); 103 fiber->start(transfer);
105 fiber->start(transfer);
106} 104}
107 105
108Fiber::Fiber(std::function<void(void*)>&& entry_point_func, void* start_parameter) 106Fiber::Fiber(std::function<void(void*)>&& entry_point_func, void* start_parameter)
109 : guard{}, entry_point{std::move(entry_point_func)}, start_parameter{start_parameter}, previous_fiber{} { 107 : guard{}, entry_point{std::move(entry_point_func)}, start_parameter{start_parameter},
108 previous_fiber{} {
110 impl = std::make_unique<FiberImpl>(); 109 impl = std::make_unique<FiberImpl>();
111 impl->context = boost::context::detail::make_fcontext(impl->stack.data(), impl->stack.size(), 110 impl->context = boost::context::detail::make_fcontext(impl->stack.data(), impl->stack.size(),
112 FiberStartFunc); 111 FiberStartFunc);