Skip to content

Commit c15f4d6

Browse files
authored
Merge pull request #75 from bcmi-labs/sebromero/fix-push-doc
Change description to use push/pop function
2 parents 5c3f105 + 49eae7e commit c15f4d6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: docs/02-data-exchange.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ SHARED(counter, int); /* A globally available, threadsafe, shared variable of ty
1616
SHARED(counter, int, 8); /* Same as before, but now the internal queue size is defined as 8. */
1717
```
1818
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.
19-
New values can be inserted naturally by using the assignment operator `=` as if it was just any ordinary variable type, i.e. `int`, `char`, ...
19+
New values can be inserted by using the `push` function that you may know from other data structures.
2020
2121
```C++
2222
/* Thread_1.inot */
2323
counter.push(10); /* Store a value into the shared variable in a threadsafe manner. */
2424
```
2525
If the internal queue is full the oldest element is discarded and the latest element is inserted into the queue.
2626

27-
Retrieving stored data works also very naturally like it would for any POD data type:
27+
Stored data can be retrieved by using the `pop` function:
2828
```C++
2929
/* Thread_2.inot */
3030
Serial.println(counter.pop()); /* Retrieves a value from the shared variable in a threadsafe manner. */

0 commit comments

Comments
 (0)