From c1a0f8173af87c55aa75f1c8a7a3a9b46a624b48 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 8 May 2017 13:25:20 -0500 Subject: require Resource protected data to be Send, make tokens !Send --- src/lib.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 5bd07e74..5de71fbd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -419,6 +419,7 @@ #![deny(warnings)] #![feature(asm)] #![feature(const_fn)] +#![feature(optin_builtin_traits)] #![no_std] extern crate cortex_m; @@ -533,7 +534,11 @@ impl Resource> { } } -unsafe impl Sync for Resource {} +unsafe impl Sync for Resource +where + T: Send, +{ +} /// A hardware peripheral as a resource /// @@ -684,6 +689,8 @@ pub struct Ceiling { _marker: PhantomData, } +impl !Send for Ceiling {} + /// Preemption threshold pub struct Threshold { _marker: PhantomData, @@ -710,6 +717,8 @@ impl Threshold { } } +impl !Send for Threshold {} + /// Priority pub struct Priority { _marker: PhantomData, @@ -725,6 +734,8 @@ where } } +impl !Send for Priority {} + /// Maps a `Resource` / `Peripheral` to its ceiling /// /// Do not implement this trait yourself. This is an implementation detail. -- cgit v1.2.3