Skip to content

can not support recursively adding tasks #36

@etorth

Description

@etorth

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions