diff options
| author | 2020-11-06 20:29:54 -0500 | |
|---|---|---|
| committer | 2020-11-06 20:36:32 -0500 | |
| commit | 00fb79b2f3f49335543c57f1d27b057320f3ff05 (patch) | |
| tree | 6a92120ea5b1c063165a295d2a8814c649522e9f /src/common/fiber.h | |
| parent | Merge pull request #4891 from lioncash/clang2 (diff) | |
| download | yuzu-00fb79b2f3f49335543c57f1d27b057320f3ff05.tar.gz yuzu-00fb79b2f3f49335543c57f1d27b057320f3ff05.tar.xz yuzu-00fb79b2f3f49335543c57f1d27b057320f3ff05.zip | |
common/fiber: Move all member variables into impl class
Hides all of the implementation details for users of the class. This has
the benefit of reducing includes and also making the fiber classes
movable again.
Diffstat (limited to 'src/common/fiber.h')
| -rw-r--r-- | src/common/fiber.h | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/src/common/fiber.h b/src/common/fiber.h index 1a027be96..5323e8579 100644 --- a/src/common/fiber.h +++ b/src/common/fiber.h | |||
| @@ -7,9 +7,6 @@ | |||
| 7 | #include <functional> | 7 | #include <functional> |
| 8 | #include <memory> | 8 | #include <memory> |
| 9 | 9 | ||
| 10 | #include "common/common_types.h" | ||
| 11 | #include "common/spin_lock.h" | ||
| 12 | |||
| 13 | #if !defined(_WIN32) && !defined(WIN32) | 10 | #if !defined(_WIN32) && !defined(WIN32) |
| 14 | namespace boost::context::detail { | 11 | namespace boost::context::detail { |
| 15 | struct transfer_t; | 12 | struct transfer_t; |
| @@ -41,8 +38,8 @@ public: | |||
| 41 | Fiber(const Fiber&) = delete; | 38 | Fiber(const Fiber&) = delete; |
| 42 | Fiber& operator=(const Fiber&) = delete; | 39 | Fiber& operator=(const Fiber&) = delete; |
| 43 | 40 | ||
| 44 | Fiber(Fiber&&) = delete; | 41 | Fiber(Fiber&&) = default; |
| 45 | Fiber& operator=(Fiber&&) = delete; | 42 | Fiber& operator=(Fiber&&) = default; |
| 46 | 43 | ||
| 47 | /// Yields control from Fiber 'from' to Fiber 'to' | 44 | /// Yields control from Fiber 'from' to Fiber 'to' |
| 48 | /// Fiber 'from' must be the currently running fiber. | 45 | /// Fiber 'from' must be the currently running fiber. |
| @@ -57,9 +54,7 @@ public: | |||
| 57 | void Exit(); | 54 | void Exit(); |
| 58 | 55 | ||
| 59 | /// Changes the start parameter of the fiber. Has no effect if the fiber already started | 56 | /// Changes the start parameter of the fiber. Has no effect if the fiber already started |
| 60 | void SetStartParameter(void* new_parameter) { | 57 | void SetStartParameter(void* new_parameter); |
| 61 | start_parameter = new_parameter; | ||
| 62 | } | ||
| 63 | 58 | ||
| 64 | private: | 59 | private: |
| 65 | Fiber(); | 60 | Fiber(); |
| @@ -77,16 +72,7 @@ private: | |||
| 77 | #endif | 72 | #endif |
| 78 | 73 | ||
| 79 | struct FiberImpl; | 74 | struct FiberImpl; |
| 80 | |||
| 81 | SpinLock guard{}; | ||
| 82 | std::function<void(void*)> entry_point; | ||
| 83 | std::function<void(void*)> rewind_point; | ||
| 84 | void* rewind_parameter{}; | ||
| 85 | void* start_parameter{}; | ||
| 86 | std::shared_ptr<Fiber> previous_fiber; | ||
| 87 | std::unique_ptr<FiberImpl> impl; | 75 | std::unique_ptr<FiberImpl> impl; |
| 88 | bool is_thread_fiber{}; | ||
| 89 | bool released{}; | ||
| 90 | }; | 76 | }; |
| 91 | 77 | ||
| 92 | } // namespace Common | 78 | } // namespace Common |