std::thread::sleep does not document its interaction with signals · Issue #129136 · rust-lang/rust (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@GKFX

Description

@GKFX

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?