summaryrefslogtreecommitdiffstats
path: root/src/common/fiber.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-02-10 18:18:23 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-18 22:29:19 +0200
commit03e4f5dac436fe361834e6b9918983e9c4787acb (patch)
treee7f25edf95ce85d07e203afb2df13830bf87907e /src/common/fiber.cpp
parentCommon: Refactor & Document Wall clock. (diff)
downloadyuzu-03e4f5dac436fe361834e6b9918983e9c4787acb.tar
yuzu-03e4f5dac436fe361834e6b9918983e9c4787acb.tar.gz
yuzu-03e4f5dac436fe361834e6b9918983e9c4787acb.tar.bz2
yuzu-03e4f5dac436fe361834e6b9918983e9c4787acb.tar.lz
yuzu-03e4f5dac436fe361834e6b9918983e9c4787acb.tar.xz
yuzu-03e4f5dac436fe361834e6b9918983e9c4787acb.tar.zst
yuzu-03e4f5dac436fe361834e6b9918983e9c4787acb.zip
Diffstat (limited to 'src/common/fiber.cpp')
-rw-r--r--src/common/fiber.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/common/fiber.cpp b/src/common/fiber.cpp
index a88a30ced..e91d86dbe 100644
--- a/src/common/fiber.cpp
+++ b/src/common/fiber.cpp
@@ -12,6 +12,7 @@
namespace Common {
+
#ifdef _MSC_VER
struct Fiber::FiberImpl {
@@ -82,7 +83,6 @@ std::shared_ptr<Fiber> Fiber::ThreadToFiber() {
}
#else
-
constexpr std::size_t default_stack_size = 1024 * 1024 * 4; // 4MB
struct alignas(64) Fiber::FiberImpl {
@@ -108,9 +108,8 @@ void Fiber::FiberStartFunc(boost::context::detail::transfer_t transfer)
Fiber::Fiber(std::function<void(void*)>&& entry_point_func, void* start_parameter)
: guard{}, entry_point{std::move(entry_point_func)}, start_parameter{start_parameter}, previous_fiber{} {
impl = std::make_unique<FiberImpl>();
- auto start_func = std::bind(&Fiber::start, this);
- impl->context =
- boost::context::detail::make_fcontext(impl->stack.data(), impl->stack.size(), &start_func);
+ impl->context = boost::context::detail::make_fcontext(impl->stack.data(), impl->stack.size(),
+ FiberStartFunc);
}
Fiber::Fiber() : guard{}, entry_point{}, start_parameter{}, previous_fiber{} {
@@ -139,7 +138,7 @@ void Fiber::YieldTo(std::shared_ptr<Fiber> from, std::shared_ptr<Fiber> to) {
ASSERT_MSG(to != nullptr, "Next fiber is null!");
to->guard.lock();
to->previous_fiber = from;
- auto transfer = boost::context::detail::jump_fcontext(to->impl.context, nullptr);
+ auto transfer = boost::context::detail::jump_fcontext(to->impl->context, nullptr);
auto previous_fiber = from->previous_fiber;
ASSERT(previous_fiber != nullptr);
previous_fiber->impl->context = transfer.fctx;