Skip to content

Commit 948fcd3

Browse files
committed
Update documentation re pop/push.
1 parent fc4930c commit 948fcd3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ New values can be inserted naturally by using the assignment operator `=` as if
1818
1919
```C++
2020
/* Thread_1.inot */
21-
counter = 10; /* Store a value into the shared variable in a threadsafe manner. */
21+
counter.push(10); /* Store a value into the shared variable in a threadsafe manner. */
2222
```
2323
If the internal queue is full the oldest element is discarded and the latest element is inserted into the queue.
2424

2525
Retrieving stored data works also very naturally like it would for any POD data type:
2626
```C++
2727
/* Thread_2.inot */
28-
Serial.println(counter); /* Retrieves a value from the shared variable in a threadsafe manner. */
28+
Serial.println(counter.pop()); /* Retrieves a value from the shared variable in a threadsafe manner. */
2929
```
3030

3131
Should the internal queue be empty when trying to read the latest available value then the thread reading the shared variable will be suspended and the next available thread will be scheduled. Once a new value is stored inside the shared variable the suspended thread resumes operation and consumes the value which has been stored in the internal queue.
@@ -55,16 +55,16 @@ DataProducerThread.counter.connectTo(DataConsumerThread_2.counter);
5555
Whenever a new value is assigned to a data source, i.e.
5656
```C++
5757
/* DataProducerThread.inot */
58-
counter = 10;
58+
counter.push(10);
5959
```
6060
data is automatically copied and stored within the internal queues of all connected data sinks, from where it can be retrieved, i.e.
6161
```C++
6262
/* DataConsumerThread_1.inot */
63-
Serial.println(counter);
63+
Serial.println(counter.pop());
6464
```
6565
```C++
6666
/* DataConsumerThread_2.inot */
67-
Serial.println(counter);
67+
Serial.println(counter.pop());
6868
```
6969
If a thread tries to read from an empty `Sink` the thread is suspended and the next ready thread is scheduled. When a new value is written to a `Source` and consequently copied to a `Sink` the suspended thread is resumed and continuous execution (i.e. read the data and act upon it).
7070

0 commit comments

Comments
 (0)