diff options
| author | 2020-02-10 14:45:08 -0400 | |
|---|---|---|
| committer | 2020-06-18 16:29:21 -0400 | |
| commit | 1f7dd36499786d373b143a4437d4c32e077a32aa (patch) | |
| tree | 26d21b113d85c6630f3ff67f7affc7c1b6f508a5 /src/common | |
| parent | Common: Make MinGW build use Windows Fibers instead of fcontext_t (diff) | |
| download | yuzu-1f7dd36499786d373b143a4437d4c32e077a32aa.tar.gz yuzu-1f7dd36499786d373b143a4437d4c32e077a32aa.tar.xz yuzu-1f7dd36499786d373b143a4437d4c32e077a32aa.zip | |
Common/Tests: Address Feedback
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/fiber.cpp | 5 | ||||
| -rw-r--r-- | src/common/fiber.h | 8 | ||||
| -rw-r--r-- | src/common/spin_lock.cpp | 3 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/common/fiber.cpp b/src/common/fiber.cpp index 050c93acb..1220eddf0 100644 --- a/src/common/fiber.cpp +++ b/src/common/fiber.cpp | |||
| @@ -32,13 +32,12 @@ void __stdcall Fiber::FiberStartFunc(void* fiber_parameter) { | |||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | Fiber::Fiber(std::function<void(void*)>&& entry_point_func, void* start_parameter) | 34 | Fiber::Fiber(std::function<void(void*)>&& entry_point_func, void* start_parameter) |
| 35 | : guard{}, entry_point{std::move(entry_point_func)}, start_parameter{start_parameter}, | 35 | : entry_point{std::move(entry_point_func)}, start_parameter{start_parameter} { |
| 36 | previous_fiber{} { | ||
| 37 | impl = std::make_unique<FiberImpl>(); | 36 | impl = std::make_unique<FiberImpl>(); |
| 38 | impl->handle = CreateFiber(0, &FiberStartFunc, this); | 37 | impl->handle = CreateFiber(0, &FiberStartFunc, this); |
| 39 | } | 38 | } |
| 40 | 39 | ||
| 41 | Fiber::Fiber() : guard{}, entry_point{}, start_parameter{}, previous_fiber{} { | 40 | Fiber::Fiber() { |
| 42 | impl = std::make_unique<FiberImpl>(); | 41 | impl = std::make_unique<FiberImpl>(); |
| 43 | } | 42 | } |
| 44 | 43 | ||
diff --git a/src/common/fiber.h b/src/common/fiber.h index 598fe7daa..7e3b130a4 100644 --- a/src/common/fiber.h +++ b/src/common/fiber.h | |||
| @@ -67,10 +67,10 @@ private: | |||
| 67 | 67 | ||
| 68 | struct FiberImpl; | 68 | struct FiberImpl; |
| 69 | 69 | ||
| 70 | SpinLock guard; | 70 | SpinLock guard{}; |
| 71 | std::function<void(void*)> entry_point; | 71 | std::function<void(void*)> entry_point{}; |
| 72 | void* start_parameter; | 72 | void* start_parameter{}; |
| 73 | std::shared_ptr<Fiber> previous_fiber; | 73 | std::shared_ptr<Fiber> previous_fiber{}; |
| 74 | std::unique_ptr<FiberImpl> impl; | 74 | std::unique_ptr<FiberImpl> impl; |
| 75 | bool is_thread_fiber{}; | 75 | bool is_thread_fiber{}; |
| 76 | }; | 76 | }; |
diff --git a/src/common/spin_lock.cpp b/src/common/spin_lock.cpp index 82a1d39ff..c7b46aac6 100644 --- a/src/common/spin_lock.cpp +++ b/src/common/spin_lock.cpp | |||
| @@ -35,8 +35,9 @@ void thread_pause() { | |||
| 35 | namespace Common { | 35 | namespace Common { |
| 36 | 36 | ||
| 37 | void SpinLock::lock() { | 37 | void SpinLock::lock() { |
| 38 | while (lck.test_and_set(std::memory_order_acquire)) | 38 | while (lck.test_and_set(std::memory_order_acquire)) { |
| 39 | thread_pause(); | 39 | thread_pause(); |
| 40 | } | ||
| 40 | } | 41 | } |
| 41 | 42 | ||
| 42 | void SpinLock::unlock() { | 43 | void SpinLock::unlock() { |