Skip to content
Snippets Groups Projects
Commit c5639a4a authored by Kornel Lesiński's avatar Kornel Lesiński
Browse files

AssertUnwindSafe and Arc/Rc wrappers

parent 832dc9a4
No related branches found
No related tags found
No related merge requests found
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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment