diff options
Diffstat (limited to 'src/common/fiber.h')
| -rw-r--r-- | src/common/fiber.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/common/fiber.h b/src/common/fiber.h index cab7bc4b5..dafc1100e 100644 --- a/src/common/fiber.h +++ b/src/common/fiber.h | |||
| @@ -46,7 +46,7 @@ public: | |||
| 46 | 46 | ||
| 47 | /// Yields control from Fiber 'from' to Fiber 'to' | 47 | /// Yields control from Fiber 'from' to Fiber 'to' |
| 48 | /// Fiber 'from' must be the currently running fiber. | 48 | /// Fiber 'from' must be the currently running fiber. |
| 49 | static void YieldTo(std::shared_ptr<Fiber> from, std::shared_ptr<Fiber> to); | 49 | static void YieldTo(std::shared_ptr<Fiber>& from, std::shared_ptr<Fiber>& to); |
| 50 | static std::shared_ptr<Fiber> ThreadToFiber(); | 50 | static std::shared_ptr<Fiber> ThreadToFiber(); |
| 51 | 51 | ||
| 52 | void SetRewindPoint(std::function<void(void*)>&& rewind_func, void* start_parameter); | 52 | void SetRewindPoint(std::function<void(void*)>&& rewind_func, void* start_parameter); |
| @@ -65,13 +65,13 @@ private: | |||
| 65 | Fiber(); | 65 | Fiber(); |
| 66 | 66 | ||
| 67 | #if defined(_WIN32) || defined(WIN32) | 67 | #if defined(_WIN32) || defined(WIN32) |
| 68 | void onRewind(); | 68 | void OnRewind(); |
| 69 | void start(); | 69 | void Start(); |
| 70 | static void FiberStartFunc(void* fiber_parameter); | 70 | static void FiberStartFunc(void* fiber_parameter); |
| 71 | static void RewindStartFunc(void* fiber_parameter); | 71 | static void RewindStartFunc(void* fiber_parameter); |
| 72 | #else | 72 | #else |
| 73 | void onRewind(boost::context::detail::transfer_t& transfer); | 73 | void OnRewind(boost::context::detail::transfer_t& transfer); |
| 74 | void start(boost::context::detail::transfer_t& transfer); | 74 | void Start(boost::context::detail::transfer_t& transfer); |
| 75 | static void FiberStartFunc(boost::context::detail::transfer_t transfer); | 75 | static void FiberStartFunc(boost::context::detail::transfer_t transfer); |
| 76 | static void RewindStartFunc(boost::context::detail::transfer_t transfer); | 76 | static void RewindStartFunc(boost::context::detail::transfer_t transfer); |
| 77 | #endif | 77 | #endif |
| @@ -79,13 +79,14 @@ private: | |||
| 79 | struct FiberImpl; | 79 | struct FiberImpl; |
| 80 | 80 | ||
| 81 | SpinLock guard{}; | 81 | SpinLock guard{}; |
| 82 | std::function<void(void*)> entry_point{}; | 82 | std::function<void(void*)> entry_point; |
| 83 | std::function<void(void*)> rewind_point{}; | 83 | std::function<void(void*)> rewind_point; |
| 84 | void* rewind_parameter{}; | 84 | void* rewind_parameter{}; |
| 85 | void* start_parameter{}; | 85 | void* start_parameter{}; |
| 86 | std::shared_ptr<Fiber> previous_fiber{}; | 86 | std::shared_ptr<Fiber> previous_fiber; |
| 87 | std::unique_ptr<FiberImpl> impl; | 87 | std::unique_ptr<FiberImpl> impl; |
| 88 | bool is_thread_fiber{}; | 88 | bool is_thread_fiber{}; |
| 89 | bool released{}; | ||
| 89 | }; | 90 | }; |
| 90 | 91 | ||
| 91 | } // namespace Common | 92 | } // namespace Common |