From ba020c0c95474238a873828ff29955c2c3618283 Mon Sep 17 00:00:00 2001 From: Sebastian Romero Date: Tue, 12 Jul 2022 17:50:40 +0200 Subject: [PATCH 1/2] Change descriptions to use push function --- docs/02-data-exchange.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/02-data-exchange.md b/docs/02-data-exchange.md index 0b21082..b9030b4 100644 --- a/docs/02-data-exchange.md +++ b/docs/02-data-exchange.md @@ -16,7 +16,7 @@ SHARED(counter, int); /* A globally available, threadsafe, shared variable of ty SHARED(counter, int, 8); /* Same as before, but now the internal queue size is defined as 8. */ ``` Writing to and reading from the shared variable may not always happen concurrently. I.e. a thread reading sensor data may update the shared variable faster than a slower reader thread would extract those values. Therefore the shared variable is modeled as a queue which can store (buffer) a certain number of entries. That way the slower reader thread can access all the values in the same order as they have been written. -New values can be inserted naturally by using the assignment operator `=` as if it was just any ordinary variable type, i.e. `int`, `char`, ... +New values can be inserted by using the `push` function that you may know from other data structures. ```C++ /* Thread_1.inot */ From 49eae7e5534d46eec7b6a6b93249264a9b3ec40f Mon Sep 17 00:00:00 2001 From: Sebastian Romero Date: Tue, 12 Jul 2022 17:54:53 +0200 Subject: [PATCH 2/2] Change description for retrieving data --- docs/02-data-exchange.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/02-data-exchange.md b/docs/02-data-exchange.md index b9030b4..65e8c63 100644 --- a/docs/02-data-exchange.md +++ b/docs/02-data-exchange.md @@ -24,7 +24,7 @@ counter.push(10); /* Store a value into the shared variable in a threadsafe mann ``` If the internal queue is full the oldest element is discarded and the latest element is inserted into the queue. -Retrieving stored data works also very naturally like it would for any POD data type: +Stored data can be retrieved by using the `pop` function: ```C++ /* Thread_2.inot */ Serial.println(counter.pop()); /* Retrieves a value from the shared variable in a threadsafe manner. */