`std::thread::sleep` does not document its interaction with signals
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Location
std::thread::sleep
Summary
POSIX permits the C function sleep to be implemented using the SIGARLM signal (sleep(3)), meaning it is non-portable to mix use of that signal with sleep. The nanosleep function, which std::thread::sleep uses, is required by POSIX not to interfere with signals (nanosleep(2)), so it should in fact be OK currently to mix std::thread::sleep with SIGALRM. However, this is not actually documented. Given that the Rust function is called "sleep" it is easy to be concerned that there might be a problem.
Could std::thread::sleep make a documented commitment not to interfere with SIGALRM?
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 with the std:🧵:sleep API documentation and the linked POSIX sleep(3) and nanosleep(2) references. Confirm the current platform behavior and decide what SIGALRM guarantee the documentation can state. Done means the sleep documentation clearly explains whether it interferes with SIGALRM and matches the implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100