We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 91b2f12 commit 2c604fcCopy full SHA for 2c604fc
test/source/thread_pool.cpp
@@ -346,3 +346,18 @@ TEST_CASE("Recursive parallel sort") {
346
347
CHECK(std::ranges::is_sorted(data));
348
}
349
+
350
+// see
351
+// https://github.com/DevShiftTeam/AppShift-MemoryPool/commit/ea5908cbbd1c9163e9bc700d102e97b53e737fe5
352
+int fib_thread_loop(int n, dp::thread_pool<>& pool) {
353
+ if (n <= 1) return n;
354
+ auto a = pool.enqueue(fib_thread_loop, n - 1, std::ref(pool));
355
+ auto b = pool.enqueue(fib_thread_loop, n - 2, std::ref(pool));
356
+ return a.get() + b.get();
357
+}
358
359
+TEST_CASE("Recursive fibonacci sequence") {
360
+ dp::thread_pool pool{};
361
+ auto result = fib_thread_loop(6, pool);
362
+ CHECK(result == 8);
363
0 commit comments