about summary refs log tree commit diff
path: root/src/libstd/old_io
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-03-24 14:50:45 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-03-24 14:50:45 -0700
commit61063459bb934288254e714fa4a4e299f9850469 (patch)
treeb07d8a095022846da39201c00d448f7b8fdded80 /src/libstd/old_io
parentf5b65c5c229b442452cba899906c10637ad399d9 (diff)
parent1ec9adcfc0da7b1cdfe8d42f7eedcbd727c6861c (diff)
downloadrust-61063459bb934288254e714fa4a4e299f9850469.tar.gz
rust-61063459bb934288254e714fa4a4e299f9850469.zip
rollup merge of #23592: alexcrichton/tweak-at-exit
There have been some recent panics on the bots and this commit is an attempt to
appease them. Previously it was considered invalid to run `rt::at_exit` after
the handlers had already started running. Due to the multithreaded nature of
applications, however, it is not always possible to guarantee this. For example
[this program][ex] will show off the abort.

[ex]: https://gist.github.com/alexcrichton/56300b87af6fa554e52d

The semantics of the `rt::at_exit` function have been modified as such:

* It is now legal to call `rt::at_exit` at any time. The return value now
  indicates whether the closure was successfully registered or not. Callers must
  now decide what to do with this information.
* The `rt::at_exit` handlers will now be run for a fixed number of iterations.
  Common cases (such as the example shown) may end up registering a new handler
  while others are running perhaps once or twice, so this common condition is
  covered by re-running the handlers a fixed number of times, after which new
  registrations are forbidden.

Some usage of `rt::at_exit` was updated to handle these new semantics, but
deprecated or unstable libraries calling `rt::at_exit` were not updated.
Diffstat (limited to 'src/libstd/old_io')
-rw-r--r--src/libstd/old_io/stdio.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstd/old_io/stdio.rs b/src/libstd/old_io/stdio.rs
index ef811f832b3..fd3fae641e2 100644
--- a/src/libstd/old_io/stdio.rs
+++ b/src/libstd/old_io/stdio.rs
@@ -240,7 +240,7 @@ pub fn stdin() -> StdinReader {
             STDIN = boxed::into_raw(box stdin);
 
             // Make sure to free it at exit
-            rt::at_exit(|| {
+            let _ = rt::at_exit(|| {
                 Box::from_raw(STDIN);
                 STDIN = ptr::null_mut();
             });