Skip to content

Commit 5512945

Browse files
committed
Implement unwind safety for Condvar
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.
1 parent 9afdb8d commit 5512945

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

library/std/src/panic.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::any::Any;
66
use crate::collections;
77
use crate::panicking;
88
use crate::sync::atomic::{AtomicU8, Ordering};
9-
use crate::sync::{Mutex, RwLock};
9+
use crate::sync::{Condvar, Mutex, RwLock};
1010
use crate::thread::Result;
1111

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

7173
#[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")]
7274
impl<T: ?Sized> RefUnwindSafe for Mutex<T> {}
7375
#[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")]
7476
impl<T: ?Sized> RefUnwindSafe for RwLock<T> {}
77+
#[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")]
78+
impl RefUnwindSafe for Condvar {}
7579

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

0 commit comments

Comments
 (0)