From 9e224c2bf18ebf8f871efb2e1aba43ed7970ebb7 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 19 Dec 2014 11:29:39 -0800 Subject: std: Re-enable at_exit() The new semantics of this function are that the callbacks are run when the *main thread* exits, not when all threads have exited. This implies that other threads may still be running when the `at_exit` callbacks are invoked and users need to be prepared for this situation. Users in the standard library have been audited in accordance to these new rules as well. Closes #20012 --- src/libstd/sys/common/net.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/libstd/sys/common/net.rs') diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index 7a09137a225..24d22eb58c5 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -22,7 +22,9 @@ use io::{IoResult, IoError}; use sys::{mod, retry, c, sock_t, last_error, last_net_error, last_gai_error, close_sock, wrlen, msglen_t, os, wouldblock, set_nonblocking, timer, ms_to_timeval, decode_error_detailed}; -use sync::{Mutex, MutexGuard}; +use sync::Mutex; +#[cfg(not(target_os = "linux"))] +use sync::MutexGuard; use sys_common::{mod, keep_going, short_write, timeout}; use prelude::*; use cmp; @@ -573,11 +575,13 @@ impl Drop for Inner { fn drop(&mut self) { unsafe { close_sock(self.fd); } } } +#[cfg(not(target_os = "linux"))] pub struct Guard<'a> { pub fd: sock_t, pub guard: MutexGuard<'a, ()>, } +#[cfg(not(target_os = "linux"))] #[unsafe_destructor] impl<'a> Drop for Guard<'a> { fn drop(&mut self) { -- cgit 1.4.1-3-g733a5