-
Notifications
You must be signed in to change notification settings - Fork 0
7924: rt: introduce runtime name #68
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
base: master
Are you sure you want to change the base?
Changes from all commits
69162aa
4962820
1b8b5f1
bc203fe
61666b1
7a34728
0f63cad
7e69fdf
c34ff62
994e4ce
b24e2c0
dd11e7f
b4db30c
33d95c1
5c207a0
f357531
5c3d7a5
b7d913f
a570a7a
92a3f7f
73850ff
ce6a4cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,9 @@ pub struct Builder { | |
| /// Runtime type | ||
| kind: Kind, | ||
|
|
||
| /// Name of the runtime. | ||
| name: Option<String>, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Severity: low 🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. value:good-to-have; category:bug; feedback: The Augment AI reviewer is correct! There is a custom implementation of std::fmt::Debug trait and the new |
||
|
|
||
| /// Whether or not to enable the I/O driver | ||
| enable_io: bool, | ||
| nevents: usize, | ||
|
|
@@ -271,6 +274,9 @@ impl Builder { | |
| Builder { | ||
| kind, | ||
|
|
||
| // Default runtime name | ||
| name: None, | ||
|
|
||
| // I/O defaults to "off" | ||
| enable_io: false, | ||
| nevents: 1024, | ||
|
|
@@ -538,6 +544,28 @@ impl Builder { | |
| self | ||
| } | ||
|
|
||
| /// Sets the name of the runtime. | ||
| /// | ||
| /// # Examples | ||
| /// | ||
| /// ``` | ||
| /// # #[cfg(not(target_family = "wasm"))] | ||
| /// # { | ||
| /// # use tokio::runtime; | ||
| /// | ||
| /// # pub fn main() { | ||
| /// let rt = runtime::Builder::new_multi_thread() | ||
| /// .name("my-runtime") | ||
| /// .build(); | ||
| /// # } | ||
| /// # } | ||
| /// ``` | ||
| pub fn name(&mut self, val: impl Into<String>) -> &mut Self { | ||
| let val = val.into(); | ||
| self.name = Some(val); | ||
| self | ||
| } | ||
|
|
||
| /// Sets a function used to generate the name of threads spawned by the `Runtime`'s thread pool. | ||
| /// | ||
| /// The default name fn is `|| "tokio-rt-worker".into()`. | ||
|
|
@@ -1633,6 +1661,7 @@ impl Builder { | |
| metrics_poll_count_histogram: self.metrics_poll_count_histogram_builder(), | ||
| }, | ||
| local_tid, | ||
| self.name.clone(), | ||
| ); | ||
|
|
||
| let handle = Handle { | ||
|
|
@@ -1814,6 +1843,7 @@ cfg_rt_multi_thread! { | |
| metrics_poll_count_histogram: self.metrics_poll_count_histogram_builder(), | ||
| }, | ||
| self.timer_flavor, | ||
| self.name.clone(), | ||
| ); | ||
|
|
||
| let handle = Handle { inner: scheduler::Handle::MultiThread(handle) }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant path dependency accidentally committed
Low Severity
The workspace root
Cargo.tomlalready has[patch.crates-io] tokio = { path = "tokio" }, which automatically redirects all workspace members'tokiodependency to the local path. Adding an explicitpath = "../tokio"totokio-macros's[dev-dependencies]is therefore redundant. Notably, thetokio-macros/Cargo.tomlheader comment itself says "Remove path dependencies (if any)" before releasing, suggesting this was a local debugging artifact that wasn't cleaned up.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value:annoying; category:bug; feedback: The Bugbot AI reviewer is not correct! The patch is used by most of the CI checks but some of them remove it to test a "pre-release". The "path" setting is needed for those pre-release checks.