-
Notifications
You must be signed in to change notification settings - Fork 253
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
Add PlayerClock::wakeup() to interrupt sleeping #1869
Add PlayerClock::wakeup() to interrupt sleeping #1869
Conversation
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.
@christophebedard Thanks for addressing my previous comments.
Now, overall looks good. However, it seems I found one missed ROSBAG2_CPP_PUBLIC
qulifier.
190649f
to
49a0e93
Compare
Pulls: #1869 |
As mentioned in #1848 (comment), we'll merge this after merging #1848. |
Signed-off-by: Christophe Bedard <[email protected]>
Signed-off-by: Christophe Bedard <[email protected]>
49a0e93
to
347585d
Compare
It has been merged, so I rebased this PR on |
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.
BTW. we likely will be able to backport it to Jazzy if we will remove virtual
keyword for newly added functions during backporting.
Pulls: #1869 |
Two new warnings on Windows are in the
|
https://github.com/Mergifyio backport jazzy |
✅ Backports have been created
|
* Add PlayerClock::wakeup() to interrupt sleeping Signed-off-by: Christophe Bedard <[email protected]> * Use PlayerClock::wakeup() in new play_next() impl Signed-off-by: Christophe Bedard <[email protected]> --------- Signed-off-by: Christophe Bedard <[email protected]> (cherry picked from commit c8feaea)
…) (#1875) * Add PlayerClock::wakeup() to interrupt sleeping (#1869) * Add PlayerClock::wakeup() to interrupt sleeping Signed-off-by: Christophe Bedard <[email protected]> * Use PlayerClock::wakeup() in new play_next() impl Signed-off-by: Christophe Bedard <[email protected]> --------- Signed-off-by: Christophe Bedard <[email protected]> (cherry picked from commit c8feaea) * Make backporting PR ABI compatible - Make "is_sleeping()" and " wakeup()" functions as non-virtual and defined only in the derived "TimeControllerClock" class. - Use "TimeControllerClock" directly instead of the "PlayerClock" base class in the player.cpp. Signed-off-by: Michael Orlov <[email protected]> --------- Signed-off-by: Michael Orlov <[email protected]> Co-authored-by: Christophe Bedard <[email protected]> Co-authored-by: Michael Orlov <[email protected]>
This adds a new
wakeup()
method toPlayerClock
. It wakes up the clock, which is (only) useful if it is currently sleeping, i.e., in asleep_until()
call. Just callingstd::condition_variable::notify_all()
on the clock's condition variable wakes it up from its sleep (i.e.,std::condition_variable::wait_for()
andstd::condition_variable::wait_until()
):This can then replace the current workaround in
Player::stop()
to force-wakeup the clock, which is to resume the clock and then immediately pause it. Since we don't actually want to pause the clock, doing this may have unintended consequences, e.g., if the player is woken up and then thinks it's not in pause mode anymore.I want to use this in #1848, but I thought a separate PR would be easier to review.