aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2017-05-08 13:25:20 -0500
committerGravatar Jorge Aparicio <jorge@japaric.io> 2017-05-08 13:25:20 -0500
commitc1a0f8173af87c55aa75f1c8a7a3a9b46a624b48 (patch)
treeeb3828c5f5424eb1100d0e6d54eb2fd4d7c898a5 /src
parentfc4cb7d472dad1ea0fa137bb116bd907efc19601 (diff)
downloadrtic-c1a0f8173af87c55aa75f1c8a7a3a9b46a624b48.tar.gz
rtic-c1a0f8173af87c55aa75f1c8a7a3a9b46a624b48.tar.zst
rtic-c1a0f8173af87c55aa75f1c8a7a3a9b46a624b48.zip
require Resource protected data to be Send, make tokens !Send
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs13
1 files changed, 12 insertions, 1 deletions
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<T, RC> Resource<T, Ceiling<RC>> {
}
}
-unsafe impl<T, C> Sync for Resource<T, C> {}
+unsafe impl<T, C> Sync for Resource<T, C>
+where
+ T: Send,
+{
+}
/// A hardware peripheral as a resource
///
@@ -684,6 +689,8 @@ pub struct Ceiling<N> {
_marker: PhantomData<N>,
}
+impl<N> !Send for Ceiling<N> {}
+
/// Preemption threshold
pub struct Threshold<T> {
_marker: PhantomData<T>,
@@ -710,6 +717,8 @@ impl<PT> Threshold<PT> {
}
}
+impl<N> !Send for Threshold<N> {}
+
/// Priority
pub struct Priority<N> {
_marker: PhantomData<N>,
@@ -725,6 +734,8 @@ where
}
}
+impl<N> !Send for Priority<N> {}
+
/// Maps a `Resource` / `Peripheral` to its ceiling
///
/// Do not implement this trait yourself. This is an implementation detail.