Skip to content

Deadlock due to running out of runnable threads #5

@rocallahan

Description

@rocallahan

Suppose I start K threads and spawn N > K tasks. Suppose each of those tasks calls Pool::scoped() to run scheduler callbacks that each spawn additional tasks in their scopes. It seems to me this can easily deadlock, since we could have all K threads stopped waiting in a Scope::join() with no threads able to run the scoped tasks that are being waited for. Right?

If so, then it's dangerous to call Scope::join() or Pool::scoped() from a Pool thread, and Scope::recurse() is always dangerous.

Maybe this could be fixed by making the waiting thread in a Scope::join() available to run pending tasks?

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