You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the thread pool will eventually deadlock if a user launches a tasks that recursively creates new tasks on the thread pool wait for a result.
Sample code:
// see// https://github.com/DevShiftTeam/AppShift-MemoryPool/commit/ea5908cbbd1c9163e9bc700d102e97b53e737fe5intfib_thread_loop(int n, dp::thread_pool<>& pool) {
if (n <= 1) return n;
auto a = pool.enqueue(fib_thread_loop, n - 1, std::ref(pool));
auto b = pool.enqueue(fib_thread_loop, n - 2, std::ref(pool));
return a.get() + b.get();
}
TEST_CASE("Recursive fibonacci sequence") {
dp::thread_pool pool{};
auto result = fib_thread_loop(4, pool);
CHECK(result == 3);
}
Currently, the thread pool will eventually deadlock if a user launches a tasks that recursively creates new tasks on the thread pool wait for a result.
Sample code:
This is also discussed in #56 .
We could possible get around this with a custom promise and future, or we could potentially use coroutines internally to allow for busy waiting.
The text was updated successfully, but these errors were encountered: