diff --git a/src/context.rs b/src/context.rs index 3867f5ad715ba38171d237948d828a92639765ca..13c967a512890ce1790686d2a87478cafc6323c0 100644 --- a/src/context.rs +++ b/src/context.rs @@ -1,3 +1,5 @@ +use std::rc::Rc; +use std::sync::Arc; use super::*; use std::ptr; use std::mem; @@ -19,6 +21,9 @@ pub struct GlobalContext { impl UnwindSafe for GlobalContext {} impl RefUnwindSafe for GlobalContext {} +impl UnwindSafe for ThreadContext {} +impl RefUnwindSafe for ThreadContext {} + #[doc(hidden)] pub trait Context { fn as_ptr(&self) -> ffi::Context; @@ -50,6 +55,20 @@ impl<'a> Context for &'a ThreadContext { } } +impl<'a> Context for Arc<ThreadContext> { + #[inline] + fn as_ptr(&self) -> ffi::Context { + self.handle + } +} + +impl<'a> Context for Rc<ThreadContext> { + #[inline] + fn as_ptr(&self) -> ffi::Context { + self.handle + } +} + impl Context for ThreadContext { #[inline] fn as_ptr(&self) -> ffi::Context {