Commit ac184a9
committed
fix(rmw): borrow guard conditions immutably, tighten the graph-event assertion
**Soundness.** `rmw_trigger_guard_condition` took `&mut GuardConditionImpl`
while `rmw_wait` holds `&GuardConditionImpl` to the same object. Moving
`triggered` behind an `AtomicBool` defined the data race but said nothing
about the aliasing: handing out a `&mut` to an object another thread holds a
`&` to is undefined behaviour whatever the field types are. All mutation
already goes through atomics in `GuardConditionState`, so `trigger` and
`reset` now take `&self`, the FFI entry point borrows via `borrow_data`, and
the wait-set accessor takes a shared reference.
**Test strength.** `reentrant_graph_event.rs` asserted the re-entrant query
saw `>= 1` publisher -- satisfiable by `local_pub`, which exists for the whole
scenario. A regression invoking the callback *before* inserting the remote
entity would still return 1 and pass, so the assertion did not depend on the
ordering it claimed to verify. It now requires both.
**Lock scope.** `EventsManager::set_callback` fires the backlog callback while
the caller's outer `Mutex<EventsManager>` guard is live -- the "outside the
lock" it releases is only the inner `event_mutex`. The docs now say so, and
`set_shared_callback` is the safe entry point for `&Mutex<EventsManager>`
holders, mirroring `update_shared_event_status`. No caller needed migrating:
`RmEventHandle::set_callback` already collects under the guard and fires after
releasing, and the remaining call sites own their manager outright.1 parent da94398 commit ac184a9
4 files changed
Lines changed: 73 additions & 9 deletions
File tree
- crates
- hiroz-tests/tests
- hiroz/src
- rmw-zenoh-rs/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
295 | 301 | | |
296 | | - | |
297 | | - | |
298 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
299 | 307 | | |
300 | 308 | | |
301 | 309 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
72 | 84 | | |
73 | 85 | | |
74 | 86 | | |
75 | 87 | | |
76 | 88 | | |
77 | 89 | | |
78 | | - | |
79 | | - | |
| 90 | + | |
80 | 91 | | |
81 | 92 | | |
82 | 93 | | |
| |||
427 | 438 | | |
428 | 439 | | |
429 | 440 | | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
430 | 475 | | |
431 | 476 | | |
432 | 477 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
59 | 67 | | |
60 | 68 | | |
61 | 69 | | |
62 | | - | |
| 70 | + | |
63 | 71 | | |
64 | 72 | | |
65 | 73 | | |
| |||
138 | 146 | | |
139 | 147 | | |
140 | 148 | | |
141 | | - | |
| 149 | + | |
| 150 | + | |
142 | 151 | | |
143 | 152 | | |
144 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
| 391 | + | |
| 392 | + | |
391 | 393 | | |
392 | | - | |
| 394 | + | |
393 | 395 | | |
394 | 396 | | |
395 | 397 | | |
| |||
0 commit comments