mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 02:35:31 +00:00
PanicSentinel: only set flag if dropped while panicking
This commit is contained in:
parent
94ee4027e8
commit
ffa7c7532f
1 changed files with 9 additions and 7 deletions
|
|
@ -55,6 +55,7 @@ pub struct PanicSentinel(Arc<AtomicBool>);
|
||||||
|
|
||||||
impl Drop for PanicSentinel {
|
impl Drop for PanicSentinel {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
|
if ::std::thread::panicking() {
|
||||||
let already_triggered = self.0.fetch_or(true, Ordering::SeqCst);
|
let already_triggered = self.0.fetch_or(true, Ordering::SeqCst);
|
||||||
|
|
||||||
if !already_triggered {
|
if !already_triggered {
|
||||||
|
|
@ -66,6 +67,7 @@ impl Drop for PanicSentinel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extract response peers
|
/// Extract response peers
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue