-
Notifications
You must be signed in to change notification settings - Fork 37.4k
refactor: Cleanup thread ctor calls #19064
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
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): |
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.
ACK 2a3ad11
Recommend reviewers view the diff squashed to one commit as the second and third commit rewrite parts of the first one.
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.
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 |
@@ -1266,7 +1267,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) | |||
node.scheduler = std::make_unique<CScheduler>(); | |||
|
|||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.