about summary refs log tree commit diff
path: root/src/libstd/rt/mod.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-01 10:19:42 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-03-20 10:56:27 -0700
commit1cc9718fdef63476ffdf3f0bcd74b554b083f378 (patch)
tree9ab128b25b8bd688a26897a5b8029672d737140e /src/libstd/rt/mod.rs
parent46f649c479ce40f3b4590590dda6c2895e8d60f6 (diff)
downloadrust-1cc9718fdef63476ffdf3f0bcd74b554b083f378.tar.gz
rust-1cc9718fdef63476ffdf3f0bcd74b554b083f378.zip
Revert "Revert "std: Re-enable at_exit()""
This reverts commit aec67c2ee0f673ea7b0e21c2fe7e0f26a523d823.
Diffstat (limited to 'src/libstd/rt/mod.rs')
-rw-r--r--src/libstd/rt/mod.rs21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs
index 90cc189b9a0..20e29998d7c 100644
--- a/src/libstd/rt/mod.rs
+++ b/src/libstd/rt/mod.rs
@@ -147,20 +147,14 @@ fn lang_start(main: *const u8, argc: int, argv: *const *const u8) -> int {
     }
 }
 
-/// Enqueues a procedure to run when the runtime is cleaned up
-///
-/// The procedure passed to this function will be executed as part of the
-/// runtime cleanup phase. For normal rust programs, this means that it will run
-/// after all other threads have exited.
-///
-/// The procedure is *not* executed with a local `Thread` available to it, so
-/// primitives like logging, I/O, channels, spawning, etc, are *not* available.
-/// This is meant for "bare bones" usage to clean up runtime details, this is
-/// not meant as a general-purpose "let's clean everything up" function.
+/// Enqueues a procedure to run when the main thread exits.
 ///
 /// It is forbidden for procedures to register more `at_exit` handlers when they
 /// are running, and doing so will lead to a process abort.
-pub fn at_exit<F:FnOnce()+Send+'static>(f: F) {
+///
+/// Note that other threads may still be running when `at_exit` routines start
+/// running.
+pub fn at_exit<F: FnOnce() + Send + 'static>(f: F) {
     at_exit_imp::push(Thunk::new(f));
 }
 
@@ -176,8 +170,5 @@ pub fn at_exit<F:FnOnce()+Send+'static>(f: F) {
 pub unsafe fn cleanup() {
     args::cleanup();
     sys::stack_overflow::cleanup();
-    // FIXME: (#20012): the resources being cleaned up by at_exit
-    // currently are not prepared for cleanup to happen asynchronously
-    // with detached threads using the resources; for now, we leak.
-    // at_exit_imp::cleanup();
+    at_exit_imp::cleanup();
 }