diff options
| author | Steven Fackler <sfackler@gmail.com> | 2014-11-29 23:07:43 -0800 |
|---|---|---|
| committer | Steven Fackler <sfackler@gmail.com> | 2014-12-03 23:18:52 -0800 |
| commit | e7c1f57d6c8781cfb3e746eac5f13f760fcde2b4 (patch) | |
| tree | 3865b4c74acc3211f6144c8dd7496820b354a1b9 /src/rustllvm/RustWrapper.cpp | |
| parent | f33d879a7094bce7e16345dcc2efa85da6f05261 (diff) | |
| download | rust-e7c1f57d6c8781cfb3e746eac5f13f760fcde2b4.tar.gz rust-e7c1f57d6c8781cfb3e746eac5f13f760fcde2b4.zip | |
Back io::stdin with a global singleton BufferedReader
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().lines() // => io::stdin().lock().lines() ``` Closes #14434 [breaking-change]
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
