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
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.
The text was updated successfully, but these errors were encountered:
I recently was scouting source of px looking whether this implemented and was considering posting a suggestion. This would be a very useful feature to have. Thank you 🙏
Pseudo code:
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.
The text was updated successfully, but these errors were encountered: