| //! Tests that make sure accessing thread-locals while exiting the thread doesn't cause panics. |
| use crossbeam_channel::{select, unbounded}; |
| use crossbeam_utils::thread::scope; |
| fn ms(ms: u64) -> Duration { |
| Duration::from_millis(ms) |
| #[cfg_attr(target_os = "macos", ignore = "TLS is destroyed too early on macOS")] |
| // A blocking operation after the thread-locals have been dropped. This will attempt to |
| // use the thread-locals and must not panic. |
| let (_s, r) = unbounded::<()>(); |
| let (s, r) = unbounded::<()>(); |
| // First initialize `FOO`, then the thread-locals related to crossbeam-channel. |
| // At thread exit, thread-locals related to crossbeam-channel get dropped first and |
| // `FOO` is dropped last. |