From 519d86ca4c528499422075b519fa1c5e960afcce Mon Sep 17 00:00:00 2001 From: edef Date: Thu, 16 Apr 2015 07:06:30 -0400 Subject: [PATCH] implement Send where applicable --- src/arch/mod.rs | 3 +++ src/context.rs | 3 +++ src/os/mod.rs | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/src/arch/mod.rs b/src/arch/mod.rs index 128c7a3..206d44a 100644 --- a/src/arch/mod.rs +++ b/src/arch/mod.rs @@ -1,7 +1,10 @@ // Copyright (c) 2015, edef // See the LICENSE file included in this distribution. +use core::prelude::*; pub use self::imp::{Registers, STACK_ALIGN}; +unsafe impl Send for Registers {} + mod common; #[cfg(target_arch = "x86_64")] diff --git a/src/context.rs b/src/context.rs index 7fa1ae8..f4a5e71 100644 --- a/src/context.rs +++ b/src/context.rs @@ -13,6 +13,9 @@ pub struct Context<'a, Stack: stack::Stack> { _ref: PhantomData<&'a ()> } +unsafe impl<'a, Stack> Send for Context<'a, Stack> + where Stack: stack::Stack + Send {} + impl<'a, Stack> Context<'a, Stack> where Stack: stack::Stack { #[inline] pub unsafe fn new(mut stack: Stack, f: F) -> Context<'a, Stack> diff --git a/src/os/mod.rs b/src/os/mod.rs index 1a0e23d..55c9ace 100644 --- a/src/os/mod.rs +++ b/src/os/mod.rs @@ -8,6 +8,9 @@ mod sys; pub struct StackSource; +unsafe impl Send for StackSource {} +unsafe impl Sync for StackSource {} + #[allow(raw_pointer_derive)] #[derive(Debug)] pub struct Stack { @@ -15,6 +18,8 @@ pub struct Stack { len: usize } +unsafe impl Send for Stack {} + impl stack::StackSource for StackSource { type Output = Stack; type Error = IoError;