You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/02-data-exchange.md
+2
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,8 @@ A `Shared` variable is a global variable accessible to all threads. It can be de
12
12
```C++
13
13
/* SharedVariables.h */
14
14
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. */
15
17
```
16
18
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.
17
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`, ...
0 commit comments