Skip to content

refactor: Remove stray cs_main redundant declaration - #26965

Merged
fanquake merged 2 commits into
bitcoin:masterfrom
maflcko:2301-cs-main-🔋
Jan 30, 2023

Hidden character warning

The head ref may contain hidden characters: "2301-cs-main-\ud83d\udd0b"
Merged

fanquake merged 2 commits into
bitcoin:masterfrom
maflcko:2301-cs-main-🔋

Conversation

@maflcko

@maflcko maflcko commented Jan 25, 2023

Copy link
Copy Markdown
Member

Looks like this was forgotten when introducing kernel/cs_main ?

Also, there is a commit to export threadsafety.h from sync.h.

All places that include sync.h will likely need threadsafety
annotations, so export them.
@DrahtBot

DrahtBot commented Jan 25, 2023 •

Copy link
Copy Markdown
Contributor

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

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK hebasto

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #26705 (clang-tidy: Check headers and fixes them by hebasto)
  • #25390 (sync: introduce a thread-safe generic container and use it to remove a bunch of "GlobalMutex"es by vasild)

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.

@DrahtBot DrahtBot changed the title refactor: Remove stray cs_main redundant declaration refactor: Remove stray cs_main redundant declaration Jan 25, 2023
@hebasto

hebasto commented Jan 25, 2023

Copy link
Copy Markdown
Member

Concept ACK.

@hebasto hebasto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK faba08b

Also, there is a commit to export threadsafety.h from sync.h.

I'm not sure about that because thread safety annotations are mostly used in headers, and sync.h can be needed to be included in source files only. For example, without that commit, node/utxo_snapshot.h needs a replacement s/#include <sync.h>/#include <threadsafety.h>/.

@maflcko

maflcko commented Jan 25, 2023

Copy link
Copy Markdown
Member Author

sync.h can be needed to be included in source files only

No? If the header uses a Mutex, it will need to include sync.h. Is there any place in the codebase that doesn't use Mutex?

@hebasto

hebasto commented Jan 25, 2023

Copy link
Copy Markdown
Member

Is there any place in the codebase that doesn't use Mutex?

For example, node/utxo_snapshot.h from this PR?

@maflcko

maflcko commented Jan 26, 2023

Copy link
Copy Markdown
Member Author

Well, I meant Mutex or RecursiveMutex, or whatever else is in sync.h.

The point is that you can't compile utxo_snapshot.h without sync.h, and any other place that uses symbols with theadsafety annotations from sync.h, in which case including theadsafety.h again serves no purpose other than noise.

@hebasto

hebasto commented Jan 26, 2023

Copy link
Copy Markdown
Member

Well, I meant Mutex or RecursiveMutex, or whatever else is in sync.h.

The point is that you can't compile utxo_snapshot.h without sync.h

It is job of <kernel/cs_main.h> now, no?

and any other place that uses symbols with theadsafety annotations from sync.h, in which case including theadsafety.h again serves no purpose other than noise.

Agree. Probably the use case of <kernel/cs_main.h> is the only counter example.

@maflcko

maflcko commented Jan 26, 2023

Copy link
Copy Markdown
Member Author

I think the only counter example (something that doesn't need sync.h directly or indirectly) is logging.h, because it only needs threadsafety, see

#include <threadsafety.h>

Though, I am not changing that in this pull.

@maflcko

maflcko commented Jan 30, 2023

Copy link
Copy Markdown
Member Author

cc @fanquake

@fanquake
fanquake merged commit 7241b93 into bitcoin:master Jan 30, 2023
@maflcko
maflcko deleted the 2301-cs-main-🔋 branch January 31, 2023 11:10
@bitcoin bitcoin locked and limited conversation to collaborators Jan 31, 2024
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.

4 participants