diff options
Diffstat (limited to 'embassy-sync/src/blocking_rwlock/raw.rs')
| -rw-r--r-- | embassy-sync/src/blocking_rwlock/raw.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/embassy-sync/src/blocking_rwlock/raw.rs b/embassy-sync/src/blocking_rwlock/raw.rs index 85e8374b5..7725edfa5 100644 --- a/embassy-sync/src/blocking_rwlock/raw.rs +++ b/embassy-sync/src/blocking_rwlock/raw.rs | |||
| @@ -126,13 +126,19 @@ mod thread_mode { | |||
| 126 | unsafe impl RawRwLock for ThreadModeRawRwLock { | 126 | unsafe impl RawRwLock for ThreadModeRawRwLock { |
| 127 | const INIT: Self = Self::new(); | 127 | const INIT: Self = Self::new(); |
| 128 | fn read_lock<R>(&self, f: impl FnOnce() -> R) -> R { | 128 | fn read_lock<R>(&self, f: impl FnOnce() -> R) -> R { |
| 129 | assert!(in_thread_mode(), "ThreadModeRwLock can only be locked from thread mode."); | 129 | assert!( |
| 130 | in_thread_mode(), | ||
| 131 | "ThreadModeRwLock can only be locked from thread mode." | ||
| 132 | ); | ||
| 130 | 133 | ||
| 131 | f() | 134 | f() |
| 132 | } | 135 | } |
| 133 | 136 | ||
| 134 | fn write_lock<R>(&self, f: impl FnOnce() -> R) -> R { | 137 | fn write_lock<R>(&self, f: impl FnOnce() -> R) -> R { |
| 135 | assert!(in_thread_mode(), "ThreadModeRwLock can only be locked from thread mode."); | 138 | assert!( |
| 139 | in_thread_mode(), | ||
| 140 | "ThreadModeRwLock can only be locked from thread mode." | ||
| 141 | ); | ||
| 136 | 142 | ||
| 137 | f() | 143 | f() |
| 138 | } | 144 | } |
| @@ -156,4 +162,4 @@ mod thread_mode { | |||
| 156 | } | 162 | } |
| 157 | } | 163 | } |
| 158 | #[cfg(any(cortex_m, feature = "std"))] | 164 | #[cfg(any(cortex_m, feature = "std"))] |
| 159 | pub use thread_mode::*; \ No newline at end of file | 165 | pub use thread_mode::*; |
