summaryrefslogtreecommitdiff
path: root/src/tests/common/fibers.cpp
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2020-02-10 13:33:13 -0400
committerGravatar Fernando Sahmkow2020-06-18 16:29:19 -0400
commit1bd706344e2381e11245b2f0bdc291429e46c634 (patch)
tree4abae5a2088df1eb023967d83c0b808eceb30cea /src/tests/common/fibers.cpp
parentCommon: Correct fcontext fibers. (diff)
downloadyuzu-1bd706344e2381e11245b2f0bdc291429e46c634.tar.gz
yuzu-1bd706344e2381e11245b2f0bdc291429e46c634.tar.xz
yuzu-1bd706344e2381e11245b2f0bdc291429e46c634.zip
Common/Tests: Clang Format.
Diffstat (limited to 'src/tests/common/fibers.cpp')
-rw-r--r--src/tests/common/fibers.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/tests/common/fibers.cpp b/src/tests/common/fibers.cpp
index 358393a19..d63194dd4 100644
--- a/src/tests/common/fibers.cpp
+++ b/src/tests/common/fibers.cpp
@@ -92,7 +92,8 @@ public:
92 92
93 void DoWork1() { 93 void DoWork1() {
94 trap2 = false; 94 trap2 = false;
95 while (trap.load()); 95 while (trap.load())
96 ;
96 for (u32 i = 0; i < 12000; i++) { 97 for (u32 i = 0; i < 12000; i++) {
97 value1 += i; 98 value1 += i;
98 } 99 }
@@ -105,7 +106,8 @@ public:
105 } 106 }
106 107
107 void DoWork2() { 108 void DoWork2() {
108 while (trap2.load()); 109 while (trap2.load())
110 ;
109 value2 = 2000; 111 value2 = 2000;
110 trap = false; 112 trap = false;
111 Fiber::YieldTo(fiber2, fiber1); 113 Fiber::YieldTo(fiber2, fiber1);
@@ -197,9 +199,12 @@ static void ThreadStart2_2(u32 id, TestControl2& test_control) {
197TEST_CASE("Fibers::InterExchange", "[common]") { 199TEST_CASE("Fibers::InterExchange", "[common]") {
198 TestControl2 test_control{}; 200 TestControl2 test_control{};
199 test_control.thread_fibers.resize(2, nullptr); 201 test_control.thread_fibers.resize(2, nullptr);
200 test_control.fiber1 = std::make_shared<Fiber>(std::function<void(void*)>{WorkControl2_1}, &test_control); 202 test_control.fiber1 =
201 test_control.fiber2 = std::make_shared<Fiber>(std::function<void(void*)>{WorkControl2_2}, &test_control); 203 std::make_shared<Fiber>(std::function<void(void*)>{WorkControl2_1}, &test_control);
202 test_control.fiber3 = std::make_shared<Fiber>(std::function<void(void*)>{WorkControl2_3}, &test_control); 204 test_control.fiber2 =
205 std::make_shared<Fiber>(std::function<void(void*)>{WorkControl2_2}, &test_control);
206 test_control.fiber3 =
207 std::make_shared<Fiber>(std::function<void(void*)>{WorkControl2_3}, &test_control);
203 std::thread thread1(ThreadStart2_1, 0, std::ref(test_control)); 208 std::thread thread1(ThreadStart2_1, 0, std::ref(test_control));
204 std::thread thread2(ThreadStart2_2, 1, std::ref(test_control)); 209 std::thread thread2(ThreadStart2_2, 1, std::ref(test_control));
205 thread1.join(); 210 thread1.join();
@@ -291,8 +296,10 @@ static void ThreadStart3(u32 id, TestControl3& test_control) {
291TEST_CASE("Fibers::StartRace", "[common]") { 296TEST_CASE("Fibers::StartRace", "[common]") {
292 TestControl3 test_control{}; 297 TestControl3 test_control{};
293 test_control.thread_fibers.resize(2, nullptr); 298 test_control.thread_fibers.resize(2, nullptr);
294 test_control.fiber1 = std::make_shared<Fiber>(std::function<void(void*)>{WorkControl3_1}, &test_control); 299 test_control.fiber1 =
295 test_control.fiber2 = std::make_shared<Fiber>(std::function<void(void*)>{WorkControl3_2}, &test_control); 300 std::make_shared<Fiber>(std::function<void(void*)>{WorkControl3_1}, &test_control);
301 test_control.fiber2 =
302 std::make_shared<Fiber>(std::function<void(void*)>{WorkControl3_2}, &test_control);
296 std::thread thread1(ThreadStart3, 0, std::ref(test_control)); 303 std::thread thread1(ThreadStart3, 0, std::ref(test_control));
297 std::thread thread2(ThreadStart3, 1, std::ref(test_control)); 304 std::thread thread2(ThreadStart3, 1, std::ref(test_control));
298 thread1.join(); 305 thread1.join();
@@ -302,6 +309,4 @@ TEST_CASE("Fibers::StartRace", "[common]") {
302 REQUIRE(test_control.value3 == 1); 309 REQUIRE(test_control.value3 == 1);
303} 310}
304 311
305
306
307} // namespace Common 312} // namespace Common