-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make rosbag2_transport::Player::play()
run in a separate thread
#1503
Conversation
6ad02e2
to
24e11e7
Compare
Signed-off-by: Patrick Roncagliolo <[email protected]>
24e11e7
to
f557dc5
Compare
I did |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@roncapat See my suggestions for review fixes in the roncapat#6 PR
Signed-off-by: Michael Orlov <[email protected]>
- Fixed multiple race conditions in tests when wait_for_playback_to_end() calls in a separate thread before Player::play() method. Those race conditions would likely lead to a false negative or flaky tests. - Replaced player_future with wait_for_playback_to_end() to the direct call of the player_->wait_for_playback_to_end() in the most of the places. Signed-off-by: Michael Orlov <[email protected]>
Signed-off-by: Michael Orlov <[email protected]>
- Rationale: To support Clang Thread Safety Analysis - Removed locally defined TSAUniqueLock which is a duplicate of the rcpputils::unique_lock. - Also removed some unused includes in player.cpp and player.hpp Signed-off-by: Michael Orlov <[email protected]>
- Rationale: Make wait_for_playback_to_finish(..) to be optionally as a non-blocking call Signed-off-by: Michael Orlov <[email protected]>
@MichaelOrlov review branch merged :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Gist: https://gist.githubusercontent.com/MichaelOrlov/aa32bdbe242c8c06daca683655e76bb4/raw/4be47e99df1fdad56dd18ce5f2d2c4f04ff13980/ros2.repos |
play()
run in a separate thread (#1500)play()
run in a separate thread
play()
run in a separate threadrosbag2_transport::Player::play()
run in a separate thread
https://github.com/Mergifyio backport iron |
✅ Backports have been created
|
) * Play spawns a separate thread Signed-off-by: Patrick Roncagliolo <[email protected]> * Address multiple race conditions in player and some renames after review Signed-off-by: Michael Orlov <[email protected]> * Fixes in the rosbag2_transport tests - Fixed multiple race conditions in tests when wait_for_playback_to_end() calls in a separate thread before Player::play() method. Those race conditions would likely lead to a false negative or flaky tests. - Replaced player_future with wait_for_playback_to_end() to the direct call of the player_->wait_for_playback_to_end() in the most of the places. Signed-off-by: Michael Orlov <[email protected]> * Rename wait_for_playback_to_end() to the wait_for_playback_to_finish() Signed-off-by: Michael Orlov <[email protected]> * Use rcpputils::unique_lock for RCPPUTILS TSA guarded mutexes - Rationale: To support Clang Thread Safety Analysis - Removed locally defined TSAUniqueLock which is a duplicate of the rcpputils::unique_lock. - Also removed some unused includes in player.cpp and player.hpp Signed-off-by: Michael Orlov <[email protected]> * Add timeout parameter to the wait_for_playback_to_finish(timeout) - Rationale: Make wait_for_playback_to_finish(..) to be optionally as a non-blocking call Signed-off-by: Michael Orlov <[email protected]> --------- Signed-off-by: Patrick Roncagliolo <[email protected]> Signed-off-by: Michael Orlov <[email protected]> Co-authored-by: Michael Orlov <[email protected]> (cherry picked from commit 1a52da8) # Conflicts: # rosbag2_transport/src/rosbag2_transport/player.cpp
Note:
|
This is intended to solve the issue reported in #1500.
CC: @MichaelOrlov @KenYN
This can be also beneficial introductory work for #1419. As it has been noticed, playback shall start automatically when the
Player
component is loaded, but this can't be done via syncronous call by the component constructor.Current status:
Anyway, I believe that a round of refactor can be done here. For example, direclty returning an
std::future
fromwait_for_playback_to_end()
. Opinions?@KenYN may I ask you also to do a test with this branch to confirm that the
play
service now returns immediately?