aboutsummaryrefslogtreecommitdiff
path: root/src/interrupt.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/interrupt.rs')
-rw-r--r--src/interrupt.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/interrupt.rs b/src/interrupt.rs
index abf9348..a6abcdd 100644
--- a/src/interrupt.rs
+++ b/src/interrupt.rs
@@ -27,7 +27,14 @@ pub unsafe trait Nr {
fn nr(&self) -> u8;
}
-unsafe impl<T> Sync for Mutex<T> {}
+// NOTE `Mutex` can be used as a channel so, the protected data must be `Send`
+// to prevent sending non-Sendable stuff (e.g. interrupt tokens) across
+// different execution contexts (e.g. interrupts)
+unsafe impl<T> Sync for Mutex<T>
+where
+ T: Send,
+{
+}
/// Disables all interrupts
#[inline(always)]
@@ -61,7 +68,7 @@ pub unsafe fn enable() {
:
:
: "volatile");
- },
+ }
#[cfg(not(target_arch = "arm"))]
() => {}
}