about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorCorey Richardson <corey@octayn.net>2014-12-05 10:06:52 -0800
committerCorey Richardson <corey@octayn.net>2014-12-05 10:06:52 -0800
commita6ce402401f0da3a48a5a183ae109a00024ba666 (patch)
tree0bc4fa5f3fe2b82889e7ab754ef68358a4cc8008 /src/rustllvm/RustWrapper.cpp
parent26f2867c2e5439156f40f18c5a828a5a94c4352a (diff)
parente7c1f57d6c8781cfb3e746eac5f13f760fcde2b4 (diff)
downloadrust-a6ce402401f0da3a48a5a183ae109a00024ba666.tar.gz
rust-a6ce402401f0da3a48a5a183ae109a00024ba666.zip
rollup merge of #19416: sfackler/global-stdin
io::stdin returns a new `BufferedReader` each time it's called, which
results in some very confusing behavior with disappearing output. It now
returns a `StdinReader`, which wraps a global singleton
`Arc<Mutex<BufferedReader<StdReader>>`. `Reader` is implemented directly
on `StdinReader`. However, `Buffer` is not, as the `fill_buf` method is
fundamentaly un-thread safe. A `lock` method is defined on `StdinReader`
which returns a smart pointer wrapping the underlying `BufferedReader`
while guaranteeing mutual exclusion.

Code that treats the return value of io::stdin as implementing `Buffer`
will break. Add a call to `lock`:

```rust
io::stdin().read_line();
// =>
io::stdin().lock().read_line();
```

Closes #14434

[breaking-change]
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions