-
Notifications
You must be signed in to change notification settings - Fork 128
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
Make library easy to install, put everything into tp
namespace, add optional boost::future
support
#5
Conversation
* Moved everything to "./include/thread_pool" * Main include file is now: <thread_pool/thread_pool.hpp> * Everything is now in the `tp` namespace * Added optional `boost::future` compatiblity with `THREAD_POOL_USE_BOOST` macro * Added `make install` command to CMakeFiles.txt * Adapted tests and benchmarks to new changes
These are obviously major breaking changes. However, they make the library much easier to install and to use. I needed I also didn't like the fact that the names and header-guards were global, as they may collide with other names. Everything is now in |
…e underlying future or packaged_task type
Thanks Vittorio, I see you really use this piece of code. I'm going to add you as one of co-owners |
Thank you. Notice that just yesterday I removed the You may want to revert to 06d600a in order to keep the API more stable for the users until we decide if |
No problem with that so far. If someone needs |
@SuperV1234 : I will update the package with these improvements. Hunter is pure CMake, but does require some additional syntax in CMake to make it all work in the package manager as well as a package config installation step. Those changes can be disabled by default. @inkooboo : Let me know if you would like to host these changes upstream/here, and I can submit a PR. Some sample syntax is shown below: CMakeLists.txt:
Version can optionally be specified in the user's project: ${CMAKE_SOURCE_DIR}/cmake/Hunter/config.cmake:
|
@headupinclouds Interesting. Do you mean changes in |
Ok, great. I will summarize some small changes here, and follow up with a PR (probably this weekend). Actually, I just reviewed the mods, and since thread-pool-cpp has no library dependencies, there is no Hunter specific syntax required. The only CMakeLists.txt change is a package config installation. Here are some non Hunter specific changes in that fork, which have allowed me to use this effectively on C++11 platforms that do support lambda initialization extensions, but don't contain true https://github.com/hunter-packages/thread-pool-cpp/blob/hunter.develop/thread_pool/worker.hpp#L4-L33
https://github.com/hunter-packages/thread-pool-cpp/blob/hunter.develop/CMakeLists.txt#L16-L29
There were some additional path/installation changes, which I believe this PR addresses. |
@headupinclouds All of above looks reasonable.
|
Yes. Also, since this is a header only library without additional dependencies, I realized it can be run without any hunter specific syntax -- just a CMake package config installation step to make it work with standard
This is because The benchmarks that use Where
https://github.com/hunter-packages/gate I could submit two independent PR's for review if you like:
|
@headupinclouds Sounds good. Thank you! Actually only benchmark itself depends on |
Why was the default template parameter added to the ThreadPool class in this PR?
|
@headupinclouds: I was cleaning up the implementation and accidentally committed my WIP changes to the |
@inkooboo : Ok, thanks for the clarification. I'll be working on a PR in parallel. I can remove the
I can take care of the template change as part of this PR. @SuperV1234 , @inkooboo ☝️ I'll submit this for review as discussed. |
I am using @inkooboo , @SuperV1234 : Thoughts? |
@headupinclouds: if you're going down that route for template <size_t TASK_SIZE=128> struct Settings
{
static constexpr auto task_size = TASK_SIZE;
};
template <typename TSettings> class ThreadPool; |
@headupinclouds: what I dislike about I'm confident that there's a nicer abstraction that allows stack-based semantics which works well with a thread pool when you are aware of the lifetime of the values you're expecting (I was experimenting with something like that here). Nevertheless, if you send a PR putting |
Ok. I'll take a look at wrapping I'll be adding a few things, such as explicit versioning and build tests to help with package management in the resulting PR. We can discuss it there. |
<thread_pool/thread_pool.hpp>
tp
namespaceboost::future
compatiblity withTHREAD_POOL_USE_BOOST
macromake install
command to CMakeFiles.txt#pragma once
THREAD_POOL_
to all header guardsclang-format
on every file