Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread pool for std::future #139

Open
olzhabay opened this issue Nov 29, 2017 · 1 comment
Open

Thread pool for std::future #139

olzhabay opened this issue Nov 29, 2017 · 1 comment

Comments

@olzhabay
Copy link
Member

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

@vicentebolea
Copy link
Member

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

auto future = async(launch::async, [](unique_ptr<tcp::socket> socket) -> bool {

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

auto future = async(launch::async, [](unique_ptr<tcp::socket> socket) -> bool {

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants