We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9e94e28 commit 453ecaeCopy full SHA for 453ecae
test/source/thread_pool.cpp
@@ -445,3 +445,18 @@ TEST_CASE("Ensure wait_for_tasks() properly blocks current execution.") {
445
446
CHECK_EQ(counter.load(), total_tasks);
447
}
448
+
449
+// see
450
+// https://github.com/DevShiftTeam/AppShift-MemoryPool/commit/ea5908cbbd1c9163e9bc700d102e97b53e737fe5
451
+int fib_thread_loop(int n, dp::thread_pool<>& pool) {
452
+ if (n <= 1) return n;
453
+ auto a = pool.enqueue(fib_thread_loop, n - 1, std::ref(pool));
454
+ auto b = pool.enqueue(fib_thread_loop, n - 2, std::ref(pool));
455
+ return a.get() + b.get();
456
+}
457
458
+TEST_CASE("Recursive fibonacci sequence") {
459
+ dp::thread_pool pool{};
460
+ auto result = fib_thread_loop(6, pool);
461
+ CHECK(result == 8);
462
0 commit comments