-
Notifications
You must be signed in to change notification settings - Fork 1
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 #62
Thread pool #62
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
93583bf
to
5d2868d
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
5d2868d
to
7ec5618
Compare
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some thoughts on the first sequential code read ;-)
a2579db
to
7b989c9
Compare
5c74dcc
to
2a99446
Compare
c2aa158
to
a9d5a9e
Compare
bd4c3ce
to
0e5d0ea
Compare
I believe this is ready for review now. The documentation looks OK, and the tests seem to pass. |
Hold on, I guess I'll move the |
Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
[why] We first erased a vector iterator, then used it to calculate its index. Strictly speaking, the iterator was invalidated by the erase() and may not be used afterwards. In debug mode, Microsoft's STL asserts on that.
... and fix an unintentionally time-dependent test for is_full().
Co-authored-by: Fini <ulf.fini.jastrow@desy.de>
[why] The task ID is an implementation detail. Proposed-by: Ulf Fini Jastrow <ulf.fini.jastrow@desy.de> Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
[why] Missing "using namespace" directive to import chrono UDLs. Reported-by: Ulf Fini Jastrow <ulf.fini.jastrow@desy.de> Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why] Missing "using trim_sv" directive. Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
[why] Having a ThreadPool class as a pure "facade" over a ThreadPoolEngine is quite confusing. [how] Provide a factory function make_thread_pool() to create a ThreadPool object in a shared_ptr, and make the ThreadPool constructor private. Proposed-by: Ulf Fini Jastrow <ulf.fini.jastrow@desy.de> Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
This commit replaces the "one-trick pony" functions is_running() and is_pending() by a quad-state get_state() function that returns an enum. Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
[why] This solves several visibility problems and the order of classes in the Doxygen documentation. Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
[why] We used Doxygen's \addtogroup command to define entries for our header files. In Doxygen 1.8.17 (Ubuntu 20), this category was selected for display with the "modules" types. Doxygen 1.9.8 has learnt about C++20 modules and reserves the "modules" type for them, so we have to use the new "topics" keyword. [how] Select both "modules" and "topics" for being displayed. Doxygen 1.8.x ignores the "topics" and Doxygen 1.9.8 does not show anything additional for "modules" because we do not have any C++ modules in GUL14. Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
[why] For various reasons, the documentation did not render as expected. Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
[why] The typedef is not useful outside of the ThreadPool class. Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
1b47f08
to
7623643
Compare
It is now implemented like that. |
[why] The test only covered the possible outcomes "pending" and "running". [how] Add tests for "canceled" and "complete". Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to merge!
What I do not understand is why we have
gul14::TaskState
butgul14::ThreadPool::TaskHandle
Maybe this is be accident - I think a unified solution would be easier for users to grasp.
What was the core guidline... if it does not need to access any members, keep it out of the class. But then...
I will have a look at the static/dynamic think later.
Thanks for the review, @Finii! I think that both architecture and usability are much better than in the original version.
The
if (handle.get_state() == ThreadPool::TaskState::complete) ...;
if (handle.get_state() == TaskState::complete) ...; I just prefer the second one. |
This is an implementation of a
ThreadPool
class. We have some similar code in use in our HLC libs across multiple servers.Some notes:
Closes #28