Skip to content

ref(hub): Remove boolean to track if we are using process hub#1125

Merged
szokeasaurusrex merged 1 commit into
masterfrom
szokeasaurusrex/thread-hub-simplification
May 26, 2026
Merged

ref(hub): Remove boolean to track if we are using process hub#1125
szokeasaurusrex merged 1 commit into
masterfrom
szokeasaurusrex/thread-hub-simplification

Conversation

@szokeasaurusrex
Copy link
Copy Markdown
Member

@szokeasaurusrex szokeasaurusrex commented May 7, 2026

Instead, it is simpler just to set the THREAD_HUB to the PROCESS_HUB (or, more specifically, an Arc-clone of it).

Stacked on #1124

{
THREAD_HUB.with(|(hub, is_process_hub)| {
if is_process_hub.get() {
f(&PROCESS_HUB.hub)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

As I understand it, this was the sole purpose of is_process_hub: so that when we are on the thread that created the hub, the current hub is the PROCESS_HUB.

The changes here eliminate the need to track is_process_hub separately, since we just make the thread hub an arc-clone of the process hub on the thread that creates the process hub.

@szokeasaurusrex szokeasaurusrex marked this pull request as ready for review May 8, 2026 09:23
@szokeasaurusrex szokeasaurusrex requested a review from lcian as a code owner May 8, 2026 09:23
@szokeasaurusrex szokeasaurusrex requested a review from giortzisg May 8, 2026 09:23
Copy link
Copy Markdown
Member

@lcian lcian left a comment

Choose a reason for hiding this comment

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

lgtm

@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/process-hub-struct branch from abb5eb3 to a5add5a Compare May 26, 2026 09:44
Instead, it is simpler just to set the `THREAD_HUB` to the `PROCESS_HUB` (or, more specifically, an Arc-clone of it).
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/thread-hub-simplification branch 2 times, most recently from 752cbbc to 87d0c23 Compare May 26, 2026 09:45
Base automatically changed from szokeasaurusrex/process-hub-struct to master May 26, 2026 13:11
@szokeasaurusrex szokeasaurusrex merged commit 87d0c23 into master May 26, 2026
23 checks passed
@szokeasaurusrex szokeasaurusrex deleted the szokeasaurusrex/thread-hub-simplification branch May 26, 2026 13:13
szokeasaurusrex added a commit that referenced this pull request May 26, 2026
Following the safety improvements in #1123, `Hub::with` no longer offers
any performance benefit over using `Hub::current`. `Hub::current`
provides a simpler API, and also returns an owned `Arc<Hub>` rather than
providing access to a `&Arc<Hub>` via a callback (necessitating a second
clone for anyone needing an owned `Arc<Hub>` in that callback).

As `Hub::current` is the arguably better API, let's deprecate
`Hub::with` and encourage folks to migrate.

Stacked on #1125
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.

2 participants