Skip to content

std::thread::sleep does not document its interaction with signals #129136

Open
@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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsT-libsRelevant to the library team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions