8000 refactor: Cleanup thread ctor calls by hebasto · Pull Request #19064 · bitcoin/bitcoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 3 commits into from
May 12, 2021
Merged

Conversation

hebasto
Copy link
Member
@hebasto hebasto commented May 24, 2020

This PR does not change behavior.
Its goal is to improve readability and maintainability of the code.

@maflcko
Copy link
Member
maflcko commented May 24, 2020

Concept ACK to enforce the void return type on threads

@Empact
Copy link
Contributor
Empact commented May 26, 2020

Concept ACK on the first two commits, ~0 on 2a816bd as I don't see the cited improvements justifying the change.

@DrahtBot
Copy link
Contributor
DrahtBot commented May 27, 2020

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, 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.

@hebasto
Copy link
Member Author
hebasto commented May 28, 2020

Updated 2a816bd -> bcd0470 (pr19064.01 -> pr19064.03, diff):

As you move this anyway, what about moving threadnames.h to thread.h and adding this to that file? Advantage would be that stuff like src/index/base.cpp that doesn't need the whole system.h can just include the slim thread.h

@hebasto
Copy link
Member Author
hebasto commented May 30, 2020

Updated bcd0470 -> 90aa1f7 (pr19064.03 -> pr19064.04, diff):

  • fixed circular dependencies

@hebasto
Copy link
Member Author
hebasto commented Jun 8, 2020

Rebased 90aa1f7 -> dd00f7c (pr19064.04 -> pr19064.05) due to the conflict with #19180.

@hebasto
Copy link
Member Author
hebasto commented Jun 9, 2020

Updated dd00f7c -> 73370d0 (pr19064.05 -> pr19064.06, diff):

  • fixed Windows builds

@hebasto
Copy link
Member Author
hebasto commented Apr 13, 2021

Updated 519838d -> 33f9134 (pr19064.16 -> pr19064.17):

Also it is moved into its own module.
@hebasto
Copy link
Member Author
hebasto commented Apr 25, 2021

Updated 33f9134 -> 2a3ad11 (pr19064.17 -> pr19064.18, diff):

Copy link
Member
@jonatack jonatack left a 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.

Copy link
Contributor
@jnewbery jnewbery left a 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?

hebasto added 2 commits April 29, 2021 18:39
Lambdas are shorter and more readable.
Changes are limited to std::thread ctor calls only.
@hebasto
Copy link
Member Author
hebasto commented Apr 29, 2021

Updated 2a3ad11 -> 792be53 (pr19064.18 -> pr19064.19, diff):

@jnewbery

Perhaps thread.h and threadnames.h should be merged?

It will introduce a new circular dependency "logging -> util/threadnames -> logging".

@hebasto hebasto marked this pull request as ready for review April 29, 2021 15:46
@jnewbery
Copy link
Contributor

utACK 792be53

@jonatack
Copy link
Member

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(); });
Copy link
Member

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?

Copy link
Member Author

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.

@maflcko
Copy link
Member
maflcko commented May 12, 2021

cr ACK 792be53

@maflcko maflcko merged commit 2e30e32 into bitcoin:master May 12, 2021
@hebasto hebasto deleted the 200524-bind branch May 12, 2021 08:13
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 12, 2021
gwillen pushed a commit to ElementsProject/elements that referenced this pull request Jun 1, 2022
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants
0