From 1cc9718fdef63476ffdf3f0bcd74b554b083f378 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 1 Jan 2015 10:19:42 -0800 Subject: Revert "Revert "std: Re-enable at_exit()"" This reverts commit aec67c2ee0f673ea7b0e21c2fe7e0f26a523d823. --- src/libstd/sys/unix/timer.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/libstd/sys/unix') diff --git a/src/libstd/sys/unix/timer.rs b/src/libstd/sys/unix/timer.rs index ef0274fdda9..ef175d68fc4 100644 --- a/src/libstd/sys/unix/timer.rs +++ b/src/libstd/sys/unix/timer.rs @@ -170,8 +170,15 @@ fn helper(input: libc::c_int, messages: Receiver, _: ()) { 1 => { loop { match messages.try_recv() { + // Once we've been disconnected it means the main thread + // is exiting (at_exit has run). We could still have + // active timers for other threads, so we're just going + // to drop them all on the floor. This is all we can + // really do, however, to prevent resource leakage. The + // remaining timers will likely start panicking quickly + // as they attempt to re-use this thread but are + // disallowed to do so. Err(TryRecvError::Disconnected) => { - assert!(active.len() == 0); break 'outer; } -- cgit 1.4.1-3-g733a5