Skip to content
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

sync: document that const_new() is not instrumented #6002

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

hds
Copy link
Contributor

@hds hds commented Sep 12, 2023

Motivation

The mutex created by Mutex::const_new() does not contain the tracing
instrumentation that drives tokio-console.

The same is true of Notify, OnceCell (including const_new_with()),
RwLock, and Semaphore.

Solution

This change adds documentation to each of the const_* constructors,
explaining that objects created this way will not be instrumented and
therefore will not appear in tokio-console. A link to the non-const
variant is provided in each case.

@github-actions github-actions bot added the R-loom-sync Run loom sync tests on this PR label Sep 12, 2023
@Darksonn Darksonn added A-tokio Area: The main tokio crate M-sync Module: tokio/sync labels Sep 12, 2023
@Darksonn
Copy link
Contributor

There are several instances on this on other synchronization primitives.

The mutex created by `Mutex::const_new()` does not contain the tracing
instrumentation that drives `tokio-console`.

The same is true of `Notify`, `OnceCell` (including `const_new_with()`),
`RwLock`, and `Semaphore`.

This change adds documentation to each of the `const_*` constructors,
explaining that objects created this way will not be instrumented and
therefore will not appear in `tokio-console`. A link to the non-const
variant is provided in each case.
@hds hds changed the title sync: document that Mutex::const_new() is not instrumented sync: document that const_new() is not instrumented Sep 13, 2023
@hds
Copy link
Contributor Author

hds commented Sep 13, 2023

@Darksonn I don't know why I thought Mutex was the only one.

Thanks for pointing that out. I've updated all the others I could find.

@Darksonn Darksonn merged commit d247e7f into master Sep 13, 2023
70 checks passed
@Darksonn Darksonn deleted the hds/const-mutex-no-tracing branch September 13, 2023 11:49
@Darksonn Darksonn added the T-docs Topic: documentation label Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-sync Module: tokio/sync R-loom-sync Run loom sync tests on this PR T-docs Topic: documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants