Commit 6ec4dc1
seqnumber: Fix C++ interopability and mutex cleanup (#1092)
* seqnumber: Fix C++ interopability
_Atomic and std::atomic are not guaranteed to be compatible.
Additionally, std::atomic introduces dependencies on the C++ standard library,
which is often too large for resource-constrained embedded systems.
This change moves all atomic operations into seqnumber.c and uses the C11
atomic_xx operations, which are safe for both C and C++ callers.
It also fixes a bug where _z_seqnumber_null was not implemented as an atomic operation.
* Ensure sequence number is correctly cleaned up in the case of C99 where a mutex is present.
---------
Co-authored-by: Peter van der Perk <[email protected]>1 parent 1b655b3 commit 6ec4dc1
File tree
3 files changed
+48
-27
lines changed- include/zenoh-pico/collections
- src
- api
- collections
3 files changed
+48
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 24 | | |
37 | 25 | | |
38 | 26 | | |
39 | 27 | | |
40 | 28 | | |
41 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
42 | 34 | | |
43 | 35 | | |
44 | 36 | | |
45 | 37 | | |
46 | 38 | | |
47 | | - | |
48 | 39 | | |
| 40 | + | |
49 | 41 | | |
50 | 42 | | |
51 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
| |||
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
60 | | - | |
| 63 | + | |
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
| |||
255 | 258 | | |
256 | 259 | | |
257 | 260 | | |
258 | | - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
259 | 264 | | |
260 | 265 | | |
261 | 266 | | |
| 267 | + | |
262 | 268 | | |
263 | 269 | | |
264 | 270 | | |
265 | 271 | | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | 272 | | |
271 | 273 | | |
272 | 274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
| |||
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
31 | 38 | | |
| 39 | + | |
| 40 | + | |
32 | 41 | | |
33 | 42 | | |
34 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
35 | 56 | | |
36 | 57 | | |
37 | 58 | | |
| |||
44 | 65 | | |
45 | 66 | | |
46 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
47 | 71 | | |
| 72 | + | |
48 | 73 | | |
49 | 74 | | |
50 | 75 | | |
| |||
70 | 95 | | |
71 | 96 | | |
72 | 97 | | |
| 98 | + | |
| 99 | + | |
73 | 100 | | |
74 | 101 | | |
75 | 102 | | |
| |||
0 commit comments