Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not support recursively adding tasks #36

Open
etorth opened this issue Aug 22, 2024 · 0 comments
Open

can not support recursively adding tasks #36

etorth opened this issue Aug 22, 2024 · 0 comments

Comments

@etorth
Copy link

etorth commented Aug 22, 2024

following code get stuck.

#include <CTPL/ctpl_stl.h>
#include <iostream>

ctpl::thread_pool p(10);

long f(int, long n)
{
    if(n == 0) return 0;
    if(n == 1) return 1;

    auto f1 = p.push(f, n - 1);
    auto f2 = p.push(f, n - 2);

    return f1.get() + f2.get();
}

int main()
{
    std::cout << f(0, 7);
    return 10;
}

This makes it's hard for a global thread pool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant