Skip to content

Allow for waiting threads to do jobs #18

@pplux

Description

@pplux

Pseudo code:

        px_sched::Sync sync;
        for(int i = 0; i < 100; ++i) {
            scheduler.runTask([&](){
                // Heavy task
                }, &sync);
        }
        scheduler.waitFor(sync);

Here the calling thread that creates the task will suspend waiting for the tasks to be finished before carrying on. This requires the pool of threads to be bigger than the actual core count to allow some threads wait for others and still have enough threads to keep using all cpus. One possible solution could be for the thread that waits on a sync object to start doing tasks from the list of tasks related to that sync object.

The idea is that if the thread needs to wait for a task to be finished it can go on and start working on that lists of tasks itself instead of waiting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions