mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-19 06:15:45 +01:00
require Resource protected data to be Send, make tokens !Send
This commit is contained in:
parent
fc4cb7d472
commit
c1a0f8173a
2 changed files with 171 additions and 1 deletions
13
src/lib.rs
13
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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue