aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy/src/util/mutex.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/embassy/src/util/mutex.rs b/embassy/src/util/mutex.rs
index db3423cb3..c8fe84026 100644
--- a/embassy/src/util/mutex.rs
+++ b/embassy/src/util/mutex.rs
@@ -108,20 +108,18 @@ pub fn in_thread_mode() -> bool {
108 108
109/// A "mutex" that does nothing and cannot be shared between threads. 109/// A "mutex" that does nothing and cannot be shared between threads.
110pub struct NoopMutex<T> { 110pub struct NoopMutex<T> {
111 inner: UnsafeCell<T>, 111 inner: T,
112} 112}
113 113
114impl<T> NoopMutex<T> { 114impl<T> NoopMutex<T> {
115 pub const fn new(value: T) -> Self { 115 pub const fn new(value: T) -> Self {
116 NoopMutex { 116 NoopMutex { inner: value }
117 inner: UnsafeCell::new(value),
118 }
119 } 117 }
120} 118}
121 119
122impl<T> NoopMutex<T> { 120impl<T> NoopMutex<T> {
123 pub fn borrow(&self) -> &T { 121 pub fn borrow(&self) -> &T {
124 unsafe { &*self.inner.get() } 122 &self.inner
125 } 123 }
126} 124}
127 125