aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2021-08-02 11:18:59 +0200
committerUlf Lilleengen <[email protected]>2021-08-02 11:18:59 +0200
commit4d8d8e386f9e85a6273cf93f1c8feb5871ed96af (patch)
tree8bdc4ab39e8ca9a5114fc5c5acf8eda01337e137
parent332bc44b8c3687492b85ff3ad3f4ea7b67608dd2 (diff)
Make RecvFuture sync
RecvFuture always locks the underlying Channel when polled.
-rw-r--r--embassy/src/util/mpsc.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/embassy/src/util/mpsc.rs b/embassy/src/util/mpsc.rs
index d41c86291..4c6e8a6f0 100644
--- a/embassy/src/util/mpsc.rs
+++ b/embassy/src/util/mpsc.rs
@@ -218,6 +218,16 @@ where
218 } 218 }
219} 219}
220 220
221// Safe to pass the receive future around since it locks channel whenever polled
222unsafe impl<'ch, M, T, const N: usize> Send for RecvFuture<'ch, M, T, N> where
223 M: Mutex<Data = ()> + Sync
224{
225}
226unsafe impl<'ch, M, T, const N: usize> Sync for RecvFuture<'ch, M, T, N> where
227 M: Mutex<Data = ()> + Sync
228{
229}
230
221impl<'ch, M, T, const N: usize> Sender<'ch, M, T, N> 231impl<'ch, M, T, const N: usize> Sender<'ch, M, T, N>
222where 232where
223 M: Mutex<Data = ()>, 233 M: Mutex<Data = ()>,