Commit 76ac33e
fix(rclcpp_action): Fixed race condition in Client
Some background information: is_ready, take_data and execute data
may be called from different threads in any order. The code in the old
state expected them to be called in series, without interruption.
This lead to multiple race conditions, as the state of the pimpl objects
was altered by the three functions in a non thread safe way.
This commit fixed this by
- Introducing a data queue that is filled in is_ready
- take_data from now only pops the front element of the data queue
- A backlog of events if held in num_unreported_events_ which will be
reported by future calls of is_ready
Signed-off-by: Janosch Machowinski <J.Machowinski@cellumation.com>1 parent 85f1c48 commit 76ac33e
2 files changed
Lines changed: 334 additions & 128 deletions
0 commit comments