aboutsummaryrefslogtreecommitdiff
path: root/embassy-sync/src
diff options
context:
space:
mode:
authormaor malka <[email protected]>2025-09-23 21:44:21 -0400
committermaor malka <[email protected]>2025-09-23 21:44:21 -0400
commitf701fc411726c57a86c0b50c649cb8bf236e7c1a (patch)
tree61a48ac36528e7c7ae9cdbe1c22c985e8bde5a2b /embassy-sync/src
parentacc3c4b98c5238950640409d6a8ab6029edda3c9 (diff)
parent56019ba197443e16b4f0b3a0fe3ff85985f6e45c (diff)
Merge remote-tracking branch 'upstream/main'
Diffstat (limited to 'embassy-sync/src')
-rw-r--r--embassy-sync/src/blocking_mutex/mod.rs4
-rw-r--r--embassy-sync/src/blocking_mutex/raw.rs4
-rw-r--r--embassy-sync/src/mutex.rs4
-rw-r--r--embassy-sync/src/rwlock.rs2
4 files changed, 6 insertions, 8 deletions
diff --git a/embassy-sync/src/blocking_mutex/mod.rs b/embassy-sync/src/blocking_mutex/mod.rs
index 11809c763..62bfc26fb 100644
--- a/embassy-sync/src/blocking_mutex/mod.rs
+++ b/embassy-sync/src/blocking_mutex/mod.rs
@@ -135,9 +135,9 @@ impl<T> Mutex<raw::NoopRawMutex, T> {
135// There's still a ThreadModeRawMutex for use with the generic Mutex (handy with Channel, for example), 135// There's still a ThreadModeRawMutex for use with the generic Mutex (handy with Channel, for example),
136// but that will require T: Send even though it shouldn't be needed. 136// but that will require T: Send even though it shouldn't be needed.
137 137
138#[cfg(any(cortex_m, feature = "std"))] 138#[cfg(any(cortex_m, doc, feature = "std"))]
139pub use thread_mode_mutex::*; 139pub use thread_mode_mutex::*;
140#[cfg(any(cortex_m, feature = "std"))] 140#[cfg(any(cortex_m, doc, feature = "std"))]
141mod thread_mode_mutex { 141mod thread_mode_mutex {
142 use super::*; 142 use super::*;
143 143
diff --git a/embassy-sync/src/blocking_mutex/raw.rs b/embassy-sync/src/blocking_mutex/raw.rs
index 50f965e00..fbb9ece15 100644
--- a/embassy-sync/src/blocking_mutex/raw.rs
+++ b/embassy-sync/src/blocking_mutex/raw.rs
@@ -89,7 +89,7 @@ unsafe impl RawMutex for NoopRawMutex {
89 89
90// ================ 90// ================
91 91
92#[cfg(any(cortex_m, feature = "std"))] 92#[cfg(any(cortex_m, doc, feature = "std"))]
93mod thread_mode { 93mod thread_mode {
94 use super::*; 94 use super::*;
95 95
@@ -147,5 +147,5 @@ mod thread_mode {
147 return unsafe { (0xE000ED04 as *const u32).read_volatile() } & 0x1FF == 0; 147 return unsafe { (0xE000ED04 as *const u32).read_volatile() } & 0x1FF == 0;
148 } 148 }
149} 149}
150#[cfg(any(cortex_m, feature = "std"))] 150#[cfg(any(cortex_m, doc, feature = "std"))]
151pub use thread_mode::*; 151pub use thread_mode::*;
diff --git a/embassy-sync/src/mutex.rs b/embassy-sync/src/mutex.rs
index 4ce6dd987..aea682899 100644
--- a/embassy-sync/src/mutex.rs
+++ b/embassy-sync/src/mutex.rs
@@ -187,7 +187,7 @@ where
187 T: ?Sized, 187 T: ?Sized,
188{ 188{
189 /// Returns a locked view over a portion of the locked data. 189 /// Returns a locked view over a portion of the locked data.
190 pub fn map<U>(this: Self, fun: impl FnOnce(&mut T) -> &mut U) -> MappedMutexGuard<'a, M, U> { 190 pub fn map<U: ?Sized>(this: Self, fun: impl FnOnce(&mut T) -> &mut U) -> MappedMutexGuard<'a, M, U> {
191 let mutex = this.mutex; 191 let mutex = this.mutex;
192 let value = fun(unsafe { &mut *this.mutex.inner.get() }); 192 let value = fun(unsafe { &mut *this.mutex.inner.get() });
193 // Don't run the `drop` method for MutexGuard. The ownership of the underlying 193 // Don't run the `drop` method for MutexGuard. The ownership of the underlying
@@ -279,7 +279,7 @@ where
279 T: ?Sized, 279 T: ?Sized,
280{ 280{
281 /// Returns a locked view over a portion of the locked data. 281 /// Returns a locked view over a portion of the locked data.
282 pub fn map<U>(this: Self, fun: impl FnOnce(&mut T) -> &mut U) -> MappedMutexGuard<'a, M, U> { 282 pub fn map<U: ?Sized>(this: Self, fun: impl FnOnce(&mut T) -> &mut U) -> MappedMutexGuard<'a, M, U> {
283 let state = this.state; 283 let state = this.state;
284 let value = fun(unsafe { &mut *this.value }); 284 let value = fun(unsafe { &mut *this.value });
285 // Don't run the `drop` method for MutexGuard. The ownership of the underlying 285 // Don't run the `drop` method for MutexGuard. The ownership of the underlying
diff --git a/embassy-sync/src/rwlock.rs b/embassy-sync/src/rwlock.rs
index 0d784a7dc..e43388c4d 100644
--- a/embassy-sync/src/rwlock.rs
+++ b/embassy-sync/src/rwlock.rs
@@ -37,8 +37,6 @@ struct State {
37/// Use [`NoopRawMutex`](crate::blocking_mutex::raw::NoopRawMutex) when data is only shared between tasks running on the same executor. 37/// Use [`NoopRawMutex`](crate::blocking_mutex::raw::NoopRawMutex) when data is only shared between tasks running on the same executor.
38/// 38///
39/// Use [`ThreadModeRawMutex`](crate::blocking_mutex::raw::ThreadModeRawMutex) when data is shared between tasks running on the same executor but you want a singleton. 39/// Use [`ThreadModeRawMutex`](crate::blocking_mutex::raw::ThreadModeRawMutex) when data is shared between tasks running on the same executor but you want a singleton.
40///
41
42pub struct RwLock<M, T> 40pub struct RwLock<M, T>
43where 41where
44 M: RawMutex, 42 M: RawMutex,