-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Document buffering behaviour fot Stdout(Lock) #137628
Copy link
Copy link
Open
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`Area: `std::io`, `std::fs`, `std::net` and `std::path`T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant 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.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`Area: `std::io`, `std::fs`, `std::net` and `std::path`T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant 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.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Location
StdoutdocumentationStdoutLockdocumentation`Summary
The handles provided by
std::io::stdout()are line-buffered, but there is nothing in the documentation suggesting this. The only mention of buffering forstdoutin the documentation is the lineI don't think this is very clear that
stdoutis buffered from this, nor that it uses line buffering.Moreover, the comments for
LineWriterShimsuggest that this mechanism can be used to alternate between line buffering and block buffering forStdout, which isn't mentioned in the documentation forStdoutat all.I do not mean to relitigate whether or not it should be buffered (previous discussion in #23818) but I'd like to clarify how it is buffered, and how one should deal with it.