Skip to content

Commit 48fbc14

Browse files
committed
Clarify wording around locking
1 parent 5b569fc commit 48fbc14

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

text/0517-io-os-reform.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,14 +1165,16 @@ pub fn stderr() -> Stderr;
11651165
```
11661166

11671167
* `stdin` - returns a handle to a **globally shared** standard input of
1168-
the process which is buffered as well. All operations on this handle will
1169-
first require acquiring a lock to ensure access to the shared buffer is
1170-
synchronized. The handle can be explicitly locked for a critical section so
1171-
relocking is not necessary.
1168+
the process which is buffered as well. Due to the globally shared nature of
1169+
this handle, all operations on `Stdin` directly will acquire a lock internally
1170+
to ensure access to the shared buffer is synchronized. This implementation
1171+
detail is also exposed through a `lock` method where the handle can be
1172+
explicitly locked for a period of time so relocking is not necessary.
11721173

11731174
The `Read` trait will be implemented directly on the returned `Stdin` handle
11741175
but the `BufRead` trait will not be (due to synchronization concerns). The
1175-
locked version of `Stdin` will provide an implementation of `BufRead`.
1176+
locked version of `Stdin` (`StdinLock`) will provide an implementation of
1177+
`BufRead`.
11761178

11771179
The design will largely be the same as is today with the `old_io` module.
11781180

0 commit comments

Comments
 (0)