VeloxDFS icon indicating copy to clipboard operation
VeloxDFS copied to clipboard

Thread pool for std::future

Open olzhabay opened this issue 7 years ago • 1 comments

When calling std::async, it creates new thread. Better having thread pool and enqueue to it functions and lambdas with return of std::future.

olzhabay avatar Nov 29 '17 03:11 olzhabay

Hey, I think you refer some of the routines at the dfs client code:

https://github.com/DICL/VeloxDFS/blob/c67a521bb7a8301b9b7616d77cde1901abc5a818/src/client/dfs.cc#L211

In this part of the code it is totally unnecessary to using async as we create a future and right after block for that future. I think it was part of the code that was written very fast. We will get back to it later

https://github.com/DICL/VeloxDFS/blob/c67a521bb7a8301b9b7616d77cde1901abc5a818/src/client/dfs.cc#L928

For this part yes thread pool is a great idea indeed, maybe you can submit a PR with the thread pool. Still it might make the code more complicating only adding some slightly performance improvement. Maybe you can suggest an easy way of implement thread pool.

Thanks for the idea!

vicentebolea avatar Jan 31 '18 08:01 vicentebolea