diff options
| author | Simonas Kazlauskas <git@kazlauskas.me> | 2015-03-05 23:03:30 +0200 |
|---|---|---|
| committer | Simonas Kazlauskas <git@kazlauskas.me> | 2015-03-06 11:22:07 +0200 |
| commit | 3f94260b0fb2639ba81a5458ec54329e4b860afd (patch) | |
| tree | b6d20a006d5873fa3b9bda16eb34ac6a4c5d6f6c /src/libstd/sys/unix/stack_overflow.rs | |
| parent | 68740b405404a3f885e388c8d31722797d519c30 (diff) | |
| download | rust-3f94260b0fb2639ba81a5458ec54329e4b860afd.tar.gz rust-3f94260b0fb2639ba81a5458ec54329e4b860afd.zip | |
Fix an easy to trigger deadlock in std::io::stdio
Being a person who somehow has taken a liking to premature optimisation, my knee-jerk reaction to
locking in std handles was preamble resembling following snippet:
let stdout = stdout();
let lstdout = stdout.lock();
let stdin = stdin();
let lstdin = stdin.lock();
and then reading from the locked handle like this:
let mut letter = [0; 1];
lstdin.read(&mut letter).unwrap();
As it is now this code will deadlock because the `read` method attempts to lock stdout as well!
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
