std::thread::sleep
does not document its interaction with signals
#129136
Labels
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Location
std::thread::sleep
Summary
POSIX permits the C function
sleep
to be implemented using theSIGARLM
signal (sleep(3)
), meaning it is non-portable to mix use of that signal with sleep. Thenanosleep
function, whichstd::thread::sleep
uses, is required by POSIX not to interfere with signals (nanosleep(2)
), so it should in fact be OK currently to mixstd::thread::sleep
withSIGALRM
. 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 withSIGALRM
?The text was updated successfully, but these errors were encountered: