From 25ddb26be815ec3029ea9d28ba812bd541a0face Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Wed, 15 Jun 2022 13:06:35 +0200 Subject: [PATCH] Improve mutex wording --- embassy/src/blocking_mutex/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/embassy/src/blocking_mutex/mod.rs b/embassy/src/blocking_mutex/mod.rs index 65daf15c..602ec8a0 100644 --- a/embassy/src/blocking_mutex/mod.rs +++ b/embassy/src/blocking_mutex/mod.rs @@ -11,13 +11,17 @@ use self::raw::RawMutex; /// /// Provides a blocking mutual exclusion primitive backed by an implementation of [`raw::RawMutex`]. /// -/// Which implementation you select depends on the context in which you're using the mutex. +/// Which implementation you select depends on the context in which you're using the mutex, and you can choose which kind +/// of interior mutability fits your use case. /// /// Use [`CriticalSectionMutex`] when data can be shared between threads and interrupts. /// /// Use [`NoopMutex`] when data is only shared between tasks running on the same executor. /// /// Use [`ThreadModeMutex`] when data is shared between tasks running on the same executor but you want a global singleton. +/// +/// In all cases, the blocking mutex is intended to be short lived and not held across await points. +/// Use the async [`Mutex`](crate::mutex::Mutex) if you need a lock that is held across await points. pub struct Mutex { // NOTE: `raw` must be FIRST, so when using ThreadModeMutex the "can't drop in non-thread-mode" gets // to run BEFORE dropping `data`.