aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-05-22 13:03:30 +0200
committerGitHub <[email protected]>2024-05-22 13:03:30 +0200
commit1d4cd85f71058c3574a0a99f7a85572d1d87441c (patch)
treed40e4bd76bf8616b337579f36488f9a8c1c7656f
parent68e784ccd6e17a2fa4dc837a6eb46b2ff93504d5 (diff)
parentaee9d5902a4feb4a5fbb8d0e719401c96f3f651e (diff)
Merge pull request #2984 from sourcebox/sync-additions
embassy-sync: fixed some documentation typos
-rw-r--r--embassy-sync/src/once_lock.rs6
-rw-r--r--embassy-sync/src/priority_channel.rs2
-rw-r--r--embassy-sync/src/pubsub/mod.rs2
3 files changed, 5 insertions, 5 deletions
diff --git a/embassy-sync/src/once_lock.rs b/embassy-sync/src/once_lock.rs
index 9332ecfaf..55608ba32 100644
--- a/embassy-sync/src/once_lock.rs
+++ b/embassy-sync/src/once_lock.rs
@@ -1,4 +1,4 @@
1//! Syncronization primitive for initializing a value once, allowing others to await a reference to the value. 1//! Synchronization primitive for initializing a value once, allowing others to await a reference to the value.
2 2
3use core::cell::Cell; 3use core::cell::Cell;
4use core::future::poll_fn; 4use core::future::poll_fn;
@@ -78,7 +78,7 @@ impl<T> OnceLock<T> {
78 /// Set the underlying value. If the value is already set, this will return an error with the given value. 78 /// Set the underlying value. If the value is already set, this will return an error with the given value.
79 pub fn init(&self, value: T) -> Result<(), T> { 79 pub fn init(&self, value: T) -> Result<(), T> {
80 // Critical section is required to ensure that the value is 80 // Critical section is required to ensure that the value is
81 // not simultaniously initialized elsewhere at the same time. 81 // not simultaneously initialized elsewhere at the same time.
82 critical_section::with(|_| { 82 critical_section::with(|_| {
83 // If the value is not set, set it and return Ok. 83 // If the value is not set, set it and return Ok.
84 if !self.init.load(Ordering::Relaxed) { 84 if !self.init.load(Ordering::Relaxed) {
@@ -99,7 +99,7 @@ impl<T> OnceLock<T> {
99 F: FnOnce() -> T, 99 F: FnOnce() -> T,
100 { 100 {
101 // Critical section is required to ensure that the value is 101 // Critical section is required to ensure that the value is
102 // not simultaniously initialized elsewhere at the same time. 102 // not simultaneously initialized elsewhere at the same time.
103 critical_section::with(|_| { 103 critical_section::with(|_| {
104 // If the value is not set, set it. 104 // If the value is not set, set it.
105 if !self.init.load(Ordering::Relaxed) { 105 if !self.init.load(Ordering::Relaxed) {
diff --git a/embassy-sync/src/priority_channel.rs b/embassy-sync/src/priority_channel.rs
index 8572d3608..2954d1b76 100644
--- a/embassy-sync/src/priority_channel.rs
+++ b/embassy-sync/src/priority_channel.rs
@@ -335,7 +335,7 @@ where
335/// buffer is full, attempts to `send` new messages will wait until a message is 335/// buffer is full, attempts to `send` new messages will wait until a message is
336/// received from the channel. 336/// received from the channel.
337/// 337///
338/// Sent data may be reordered based on their priorty within the channel. 338/// Sent data may be reordered based on their priority within the channel.
339/// For example, in a [`Max`](heapless::binary_heap::Max) [`PriorityChannel`] 339/// For example, in a [`Max`](heapless::binary_heap::Max) [`PriorityChannel`]
340/// containing `u32`'s, data sent in the following order `[1, 2, 3]` will be received as `[3, 2, 1]`. 340/// containing `u32`'s, data sent in the following order `[1, 2, 3]` will be received as `[3, 2, 1]`.
341pub struct PriorityChannel<M, T, K, const N: usize> 341pub struct PriorityChannel<M, T, K, const N: usize>
diff --git a/embassy-sync/src/pubsub/mod.rs b/embassy-sync/src/pubsub/mod.rs
index af3d6db2a..637336d9d 100644
--- a/embassy-sync/src/pubsub/mod.rs
+++ b/embassy-sync/src/pubsub/mod.rs
@@ -437,7 +437,7 @@ pub enum Error {
437trait SealedPubSubBehavior<T> { 437trait SealedPubSubBehavior<T> {
438 /// Try to get a message from the queue with the given message id. 438 /// Try to get a message from the queue with the given message id.
439 /// 439 ///
440 /// If the message is not yet present and a context is given, then its waker is registered in the subsriber wakers. 440 /// If the message is not yet present and a context is given, then its waker is registered in the subscriber wakers.
441 fn get_message_with_context(&self, next_message_id: &mut u64, cx: Option<&mut Context<'_>>) -> Poll<WaitResult<T>>; 441 fn get_message_with_context(&self, next_message_id: &mut u64, cx: Option<&mut Context<'_>>) -> Poll<WaitResult<T>>;
442 442
443 /// Get the amount of messages that are between the given the next_message_id and the most recent message. 443 /// Get the amount of messages that are between the given the next_message_id and the most recent message.