Skip to content

feat(runtime): enable current_thread_id on nightly#548

Merged
Berrysoft merged 1 commit intocompio-rs:masterfrom
Berrysoft:dev/current-thread-id
Nov 29, 2025
Merged

feat(runtime): enable current_thread_id on nightly#548
Berrysoft merged 1 commit intocompio-rs:masterfrom
Berrysoft:dev/current-thread-id

Conversation

@Berrysoft
Copy link
Member

They are equvalent on major targets.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enables the use of Rust's nightly std::thread::current_id() API as a performance optimization for thread ID retrieval in the runtime. When the current_thread_id feature is enabled on nightly Rust, the code uses the standard library's optimized implementation instead of a thread-local storage fallback.

  • Adds current_thread_id feature flag to enable nightly std::thread::current_id() API
  • Refactors SendWrapper to conditionally use either the nightly API or thread-local fallback
  • Includes the new feature in the nightly meta-feature for convenience

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
compio/Cargo.toml Adds current_thread_id feature flag and includes it in the nightly meta-feature
compio-runtime/Cargo.toml Defines the current_thread_id feature flag and includes it in nightly
compio-runtime/src/lib.rs Adds feature gate to enable the nightly current_thread_id Rust feature
compio-runtime/src/runtime/send_wrapper.rs Refactors thread ID retrieval to use std::thread::current_id() when feature is enabled, with fallback to thread-local implementation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copy link
Member

@George-Miao George-Miao left a comment

Choose a reason for hiding this comment

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

LGTM

@Berrysoft Berrysoft merged commit 05e1e03 into compio-rs:master Nov 29, 2025
59 of 62 checks passed
@Berrysoft Berrysoft deleted the dev/current-thread-id branch November 29, 2025 18:05
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.

3 participants