From c5639a4ab8d833569393415324f0f710c6dc4671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kornel=20Lesin=CC=81ski?= <kornel@geekhood.net> Date: Tue, 5 May 2020 16:56:14 +0100 Subject: [PATCH] AssertUnwindSafe and Arc/Rc wrappers --- src/context.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/context.rs b/src/context.rs index 3867f5a..13c967a 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 { -- GitLab