Skip to content

Commit

Permalink
Implement unwind safety for Condvar
Browse files Browse the repository at this point in the history
Closes #118009

This commit adds unwind safety to Condvar. Previously, only select
platforms implemented unwind safety through auto traits. Known by this
committer: Linux was unwind safe, but Mac and Windows are not before
this change.
  • Loading branch information
ecton committed Feb 28, 2024
1 parent 9afdb8d commit 5512945
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion library/std/src/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::any::Any;
use crate::collections;
use crate::panicking;
use crate::sync::atomic::{AtomicU8, Ordering};
use crate::sync::{Mutex, RwLock};
use crate::sync::{Condvar, Mutex, RwLock};
use crate::thread::Result;

#[doc(hidden)]
Expand Down Expand Up @@ -67,11 +67,15 @@ pub fn panic_any<M: 'static + Any + Send>(msg: M) -> ! {
impl<T: ?Sized> UnwindSafe for Mutex<T> {}
#[stable(feature = "catch_unwind", since = "1.9.0")]
impl<T: ?Sized> UnwindSafe for RwLock<T> {}
#[stable(feature = "catch_unwind", since = "1.9.0")]
impl UnwindSafe for Condvar {}

#[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")]
impl<T: ?Sized> RefUnwindSafe for Mutex<T> {}
#[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")]
impl<T: ?Sized> RefUnwindSafe for RwLock<T> {}
#[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")]
impl RefUnwindSafe for Condvar {}

// https://github.com/rust-lang/rust/issues/62301
#[stable(feature = "hashbrown", since = "1.36.0")]
Expand Down

0 comments on commit 5512945

Please sign in to comment.