`std::thread::yield_now()` example is lacking.
Open
Nobody has claimed this yet.
A-docs
C-discussion
T-libs
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Location
rust/library/std/src/thread/mod.rs:755
/// # Examples
///
/// ```
/// use std::thread;
///
/// thread::yield_now();
/// ```
Summary
It's not great, ideally it should show a mostly real use case.
It should maybe hint that this should not be used directly to create spin loops without first considering std::hint::spin_loop
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at rust/library/std/src/thread/mod.rs:755 and read the existing std:🧵:yield_now documentation and example. Replace the minimal call with a mostly real use case, and explain that yield_now should not be used directly to create spin loops without considering std::hint::spin_loop. Done means the example and guidance are clearer and remain valid Rust documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100