diff options
| author | darktux <darktux@y2nlvhmmk5jnsvechppxnbyzmmv3vbl7dvzn6ltwcdbpgxixp3clkgqd.onion> | 2024-04-05 01:58:30 +0200 |
|---|---|---|
| committer | Briar <205427297+icybriarr@users.noreply.github.com> | 2025-04-04 03:40:47 +0200 |
| commit | 16f92e5b3220969783269b15dde46e314c6afc5c (patch) | |
| tree | f3551089bae8dc8a33b6e68177244a4a002a7b88 /src/tests | |
| parent | 60643dd1b26ada04c67f8f4368ef19f0d385c946 (diff) | |
Implemented rewindless Fiber without Boost (using minicoro)
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/common/fibers.cpp | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/tests/common/fibers.cpp b/src/tests/common/fibers.cpp index ecad7583ff..83c0946c9e 100644 --- a/src/tests/common/fibers.cpp +++ b/src/tests/common/fibers.cpp @@ -271,43 +271,4 @@ TEST_CASE("Fibers::StartRace", "[common]") { REQUIRE(test_control.value3 == 1); } -class TestControl4; - -class TestControl4 { -public: - TestControl4() { - fiber1 = std::make_shared<Fiber>([this] { DoWork(); }); - goal_reached = false; - rewinded = false; - } - - void Execute() { - thread_fiber = Fiber::ThreadToFiber(); - Fiber::YieldTo(thread_fiber, *fiber1); - thread_fiber->Exit(); - } - - void DoWork() { - fiber1->SetRewindPoint([this] { DoWork(); }); - if (rewinded) { - goal_reached = true; - Fiber::YieldTo(fiber1, *thread_fiber); - } - rewinded = true; - fiber1->Rewind(); - } - - std::shared_ptr<Common::Fiber> fiber1; - std::shared_ptr<Common::Fiber> thread_fiber; - bool goal_reached; - bool rewinded; -}; - -TEST_CASE("Fibers::Rewind", "[common]") { - TestControl4 test_control{}; - test_control.Execute(); - REQUIRE(test_control.goal_reached); - REQUIRE(test_control.rewinded); -} - } // namespace Common |
