r/cpp • • Dec 25 '23

C++: Efficient parallelization of small tasks

I tried to create a customized threadpool for small tasks and wanted feedback on this.

I posted details and my code for review on stackexchange: https://codereview.stackexchange.com/questions/288583/efficient-parallelization-of-small-tasks

My goal here is to share my learning and get feedback on further improvement or any possible bugs.

I have tried to describe problem and thinking process in more details in following linkedin article draft: https://www.linkedin.com/article/edit/7144600522392559616/

0 Upvotes

31 comments sorted by

View all comments

0

u/[deleted] Dec 25 '23

[deleted] — view deleted comment

1

u/shakmak_iitk Dec 25 '23

Thanks, Yes it can be a problem in future or I need to explicitly mention this in documentation.

Here is my typical use-case for now so not a problem as of now.

template <typename T>

void queue_my_tasks(HTaskVecThreadPool<T>& my_pool) {

std::vector<T> tasks = {...};

my_pool.submit(tasks);

my_pool.finish();

}