-
Notifications
You must be signed in to change notification settings - Fork 76
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
Replace existing RealtimeBox implementation with RealtimeBoxBestEffort implementation #146
Replace existing RealtimeBox implementation with RealtimeBoxBestEffort implementation #146
Conversation
…meBox, enable/disable certain methods for pointer types, Box is now usable for pointer types
…tests into a single file and adapted the naming of the existing tests for the RealtimeBox
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #146 +/- ##
==========================================
+ Coverage 73.11% 73.47% +0.36%
==========================================
Files 8 7 -1
Lines 398 411 +13
Branches 65 67 +2
==========================================
+ Hits 291 302 +11
Misses 68 68
- Partials 39 41 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@christophfroehlich I will update this PR as soon as #139 is finished |
Fixes #138 |
@christophfroehlich Given that #139 is now merged I updated this PR. Also pinging @saikishor |
@christophfroehlich Just a note about the CI. Interestingly I just had the case that pre-commit in the CI failed but did run sucessfully on my system. (Note about using the right include guard - REALTIME_TOOLS__REALTIME_BOX_H_) |
The only package of the listed dependencies above which use any of the RealtimeBox/RealTimeBoxBestEffort classes is this ur_controller: It uses a shared pointer, but will fail if we delete the RealTimeBoxBestEffort classname. Would a |
Our @fmauch might want to fix this ? I think this controller is rather new - so the impact of fixing this would be managable. And in order to answer your question @christophfroehlich -
From my understanding using a shared_ptr isn't safer in anyway (apart from memory safety) than a normal pointer with the RealTimeBox -> That is the reason I enforced using the methods that are overloaded with a The discussion is basically the same as in the beginning: Shall we enforce correct behavior and possibly break dependent code or do we add back the deprecation workaround - which is annoying to maintain. |
Yup let's do that. I don't know if we can add deprecation notice to the using keyword. If so, we can add it and ask everyone to switch to new RealTimeBox?
You are absolutely right. The other day I was checking the same and it doesn't make sense to use Pointers here, as you can still change it outside the RealTimeBox class. As you said, it is meant for classes and structs to be used safely.
As the Original API is simple and it already mentions in the documentation note to use shared_ptrs I don't mind merging it and see what will be the case. I apologize for delaying this so far. |
@firesurfer I'll do one final review to see if I find something. |
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.
@firesurfer Overall looks good to me, I've opened discussion at some points.
conversion operator should use try_get not try_set Co-authored-by: Sai Kishor Kothakota <saisastra3@gmail.com>
Fixed copyright and comments
…tion to std::mutex and std::recursive_mutex
Co-authored-by: Sai Kishor Kothakota <saisastra3@gmail.com>
I'll add it to my tech debt list :-) Thanks for adding the deprecation layer, though! |
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
Thank you so much @firesurfer for the follow-up
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 as far as I can assess this. Thanks again for the follow-up on this
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.
see the clang fix above
Co-authored-by: Christoph Fröhlich <christophfroehlich@users.noreply.github.com>
5db607c
into
ros-controls:master
Hi as said in #139 this PR replaces the existing RealtimeBox implementation with the new implementation provided in #139 . I merged the tests into a single file and they work fine (even though the existing implementation had only a very small amount of tests)
The implementation of the get/set methods matches exactly the one from the existing implementation apart from some template magic which disables the standard get/set methods for pointer types. (For which they wouldnt provide any thread safety btw from my point of view - see #138)
TLDR: Merging this has the potential to break existing code if someone used pointer types with the RealtimeBox. For everything else it should work just fine.
I would also be happy to provide some documentation on how to use this implementation but I am not sure where in the repository it should go.
This PR should be merged after #139
EDIT: One question regarding the copyright notice for the existing tests. How should this be handled? At the moment I didn't copy any of it to the merged file.