diff options
author | Alan Somers <asomers@gmail.com> | 2018-03-06 19:12:30 -0700 |
---|---|---|
committer | Alan Somers <asomers@gmail.com> | 2018-03-22 16:53:12 -0600 |
commit | 6703bc8a654f4a4cff352a1959c08217f878adb0 (patch) | |
tree | 7ed29e5898211f1c17fde275f7f5513fc6424c56 | |
parent | 4bdbf59fe5c1fd3409aa027d0ec0ea50065b39bb (diff) | |
download | nix-6703bc8a654f4a4cff352a1959c08217f878adb0.zip |
Fix an annoying double panic
A double panic can screw up the first panic's stack trace. Better not
to assert! anything when the thread is already panicing.
-rw-r--r-- | src/sys/aio.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sys/aio.rs b/src/sys/aio.rs index 745ce71b..5cb3b818 100644 --- a/src/sys/aio.rs +++ b/src/sys/aio.rs @@ -32,6 +32,7 @@ use std::marker::PhantomData; use std::mem; use std::ops::Deref; use std::ptr::{null, null_mut}; +use std::thread; use sys::signal::*; use sys::time::TimeSpec; @@ -985,7 +986,8 @@ impl<'a> Drop for AioCb<'a> { /// If the `AioCb` has no remaining state in the kernel, just drop it. /// Otherwise, dropping constitutes a resource leak, which is an error fn drop(&mut self) { - assert!(!self.in_progress, "Dropped an in-progress AioCb"); + assert!(thread::panicking() || !self.in_progress, + "Dropped an in-progress AioCb"); } } |