Skip to content

refactor: access ThreadContext through CurrentThread(), ci: switch Bitcoin Core to master - #323

Merged
ryanofsky merged 2 commits into
bitcoin-core:masterfrom
Sjors:2026/07/pr318-minimal
Jul 30, 2026
Merged

refactor: access ThreadContext through CurrentThread(), ci: switch Bitcoin Core to master#323
ryanofsky merged 2 commits into
bitcoin-core:masterfrom
Sjors:2026/07/pr318-minimal

Conversation

@Sjors

@Sjors Sjors commented Jul 29, 2026

Copy link
Copy Markdown
Member

This is a minimal subset from #318 needed to match the shim introduced by bitcoin/bitcoin#35084. Should unblock #322, see #322 (comment).

Include #322 here, because CI will not pass now since bitcoin/bitcoin#35084 merged.

Introduce CurrentThread() as an accessor for the existing namespace-scope thread_local object and migrate internal callers to it. This does not change storage duration, initialization, destruction, the exported TLS symbol, or its lint suppressions.

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
@DrahtBot

DrahtBot commented Jul 29, 2026

Copy link
Copy Markdown

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

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK hebasto, xyzconstant, ViniciusCestarii, ryanofsky

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

@Sjors Sjors changed the title refactor: access ThreadContext through CurrentThread() refactor: access ThreadContext through CurrentThread(), ci: switch Bitcoin Core to master Jul 29, 2026

@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 66298c7.

@xyzconstant

Copy link
Copy Markdown
Contributor

ACK 66298c7

@ViniciusCestarii ViniciusCestarii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK 66298c7

@ryanofsky ryanofsky left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code review ACK 66298c7. This nicely separates the CurrentThread refactoring from the mingw bug workaround. But it's misleading to call this a minimal fix for compatibility, because a minimal fix would just be:

--- a/include/mp/proxy-io.h
+++ b/include/mp/proxy-io.h
@@ -934,6 +934,10 @@ extern thread_local ThreadContext g_thread_context; // NOLINT(bitcoin-nontrivial
 // cannot be thread_local" which should not be a problem on modern platforms, and
 // could lead to a small memory leak at worst on older ones.

+inline ThreadContext& CurrentThread()
+{
+    return g_thread_context;
+}
 } // namespace mp

 #endif // MP_PROXY_IO_H

@ryanofsky
ryanofsky merged commit f5c15ce into bitcoin-core:master Jul 30, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants