Skip to content

Commit 81604f5

Browse files
committed
Extending documentation to mention the possibility of a size-configurable Shared abstraction.
1 parent 3ee47b0 commit 81604f5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/02-data-exchange.md

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ A `Shared` variable is a global variable accessible to all threads. It can be de
1212
```C++
1313
/* SharedVariables.h */
1414
SHARED(counter, int); /* A globally available, threadsafe, shared variable of type 'int'. */
15+
/* ... or ... */
16+
SHARED(counter, int, 8); /* Same as before, but now the internal queue size is defined as 8. */
1517
```
1618
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.
1719
New values can be inserted naturally by using the assignment operator `=` as if it was just any ordinary variable type, i.e. `int`, `char`, ...

0 commit comments

Comments
 (0)