refactor: Cleanup thread ctor calls#19064
Conversation
|
Concept ACK to enforce the void return type on threads |
|
Concept ACK on the first two commits, ~0 on 2a816bd as I don't see the cited improvements justifying the change. |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
Updated 2a816bd -> bcd0470 (pr19064.01 -> pr19064.03, diff):
|
|
Updated bcd0470 -> 90aa1f7 (pr19064.03 -> pr19064.04, diff):
|
|
Rebased 90aa1f7 -> dd00f7c (pr19064.04 -> pr19064.05) due to the conflict with #19180. |
|
Updated dd00f7c -> 73370d0 (pr19064.05 -> pr19064.06, diff):
|
|
Updated 519838d -> 33f9134 (pr19064.16 -> pr19064.17): |
Also it is moved into its own module.
|
Updated 33f9134 -> 2a3ad11 (pr19064.17 -> pr19064.18, diff): |
jnewbery
left a comment
There was a problem hiding this comment.
Looks good. A few suggestions inline.
Perhaps thread.h and threadnames.h should be merged?
Lambdas are shorter and more readable. Changes are limited to std::thread ctor calls only.
|
Updated 2a3ad11 -> 792be53 (pr19064.18 -> pr19064.19, diff):
It will introduce a new circular dependency "logging -> util/threadnames -> logging". |
|
utACK 792be53 |
|
Changes are even nicer now. tACK 792be53 |
|
|
||
| // Start the lightweight task scheduler thread | ||
| node.scheduler->m_service_thread = std::thread([&] { TraceThread("scheduler", [&] { node.scheduler->serviceQueue(); }); }); | ||
| node.scheduler->m_service_thread = std::thread(util::TraceThread, "scheduler", [&] { node.scheduler->serviceQueue(); }); |
There was a problem hiding this comment.
Is there a reason or even a difference between sometimes using &util::TraceThread and other times util::TraceThread?
There was a problem hiding this comment.
No, there isn't. See https://en.cppreference.com/w/cpp/language/pointer#Pointers_to_functions
It seems I overlooked that inconsistency.
|
cr ACK 792be53 |
This PR does not change behavior.
Its goal is to improve readability and maintainability of the code.