From 4d22fc88bfbad8e4e426b3e5553a96b6c4e3bf05 Mon Sep 17 00:00:00 2001 From: Guelakais Date: Tue, 25 Jun 2024 14:58:08 +0200 Subject: [PATCH] Update writing_a_simple_publisher_and_subscriber.md done --- docs/writing_a_simple_publisher_and_subscriber.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/writing_a_simple_publisher_and_subscriber.md b/docs/writing_a_simple_publisher_and_subscriber.md index 06a75bdf..a682fdb1 100644 --- a/docs/writing_a_simple_publisher_and_subscriber.md +++ b/docs/writing_a_simple_publisher_and_subscriber.md @@ -385,8 +385,8 @@ A few special features: * `let data: Arc>> = Arc::new(Mutex::new(None));` This line creates a shared data structure that will hold the received message. * `Arc>>`: This is a complex type combining several functionalities: - * `Arc`: An atomically reference-counted pointer ([`Arc`](https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://doc.rust-lang.org/std/sync/struct.Arc.html&ved=2ahUKEwiJz_n3876FAxXZg_0HHc-yDZ8QFnoECAYQAQ&usg=AOvVaw2ZAPxD2olFejU3a_Ngb4f5)) allows multiple parts of the code to safely access the same data (`T`). - * `Mutex`: A mutual exclusion lock ([`Mutex`](https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://doc.rust-lang.org/std/sync/struct.Mutex.html&ved=2ahUKEwjNx8uP9L6FAxVrhP0HHY4DB3YQFnoECAcQAQ&usg=AOvVaw3gOprM5PxBUUZd_3W6wFaG)) ensures only one thread can modify the data (`T`) at a time, preventing race conditions. + * `Arc`: An atomically reference-counted pointer ([`Arc`](https://doc.rust-lang.org/std/sync/struct.Arc.html)) allows multiple parts of the code to safely access the same data (`T`). + * `Mutex`: A mutual exclusion lock ([`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html)) ensures only one thread can modify the data (`T`) at a time, preventing race conditions. * `Option`: This represents an optional value that can either hold a message of type `StringMsg` or be `None` if no message has been received yet. * `Arc::new(Mutex::new(None))`: This creates a new instance of `Arc>>` and initializes the inner `Mutex` with `None`. 2. Creating a Subscription: