diff options
author | 2019-10-15 19:12:05 -0500 | |
---|---|---|
committer | 2019-10-15 19:31:46 -0500 | |
commit | a458a0703153f17ae9170ea88a38348ebd290388 (patch) | |
tree | 8a49a452b32fb5487eed34971fc755762477fef7 /src | |
parent | 6207008884c6ae8e465933a445cca796a43d1b53 (diff) | |
download | rtic-a458a0703153f17ae9170ea88a38348ebd290388.tar.gz rtic-a458a0703153f17ae9170ea88a38348ebd290388.tar.zst rtic-a458a0703153f17ae9170ea88a38348ebd290388.zip |
cyccnt::Instant: simplify the Send / Sync impl
originally the type was made `!Send` because it loses its meaning when
send from one core to another but that was an incorrect use of the `Send`
bound (the send operation makes the value incorrect but that doesn't cause
memory unsafety on its own). So later the type was (explicitly) made `Send`
again resulting in a convoluted implementation -- this commit simplifies things.
Diffstat (limited to 'src')
-rw-r--r-- | src/cyccnt.rs | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/cyccnt.rs b/src/cyccnt.rs index 1c215606..86969cb1 100644 --- a/src/cyccnt.rs +++ b/src/cyccnt.rs @@ -3,9 +3,7 @@ use core::{ cmp::Ordering, convert::{Infallible, TryInto}, - fmt, - marker::PhantomData, - ops, + fmt, ops, }; use cortex_m::peripheral::DWT; @@ -28,19 +26,13 @@ use crate::Fraction; #[derive(Clone, Copy, Eq, PartialEq)] pub struct Instant { inner: i32, - _not_send_or_sync: PhantomData<*mut ()>, } -unsafe impl Sync for Instant {} - -unsafe impl Send for Instant {} - impl Instant { /// Returns an instant corresponding to "now" pub fn now() -> Self { Instant { inner: DWT::get_cycle_count() as i32, - _not_send_or_sync: PhantomData, } } @@ -222,9 +214,6 @@ impl crate::Monotonic for CYCCNT { } fn zero() -> Instant { - Instant { - inner: 0, - _not_send_or_sync: PhantomData, - } + Instant { inner: 0 } } } |