-
Notifications
You must be signed in to change notification settings - Fork 5
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
src: make nsolid::ThreadMetrics safer #37
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4062088
to
efca53f
Compare
1a1236e
to
b2c1bb3
Compare
601cc15
to
8f5c66a
Compare
8f5c66a
to
ebeff03
Compare
f3399e1
to
12dcf71
Compare
d41c671
to
0246a12
Compare
trevnorris
approved these changes
Dec 13, 2023
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.
Doing it this way has grown on me. Great change. Please address the comments I left before merging.
The current ThreadMetrics API is not easy to use safely because the `ThreadMetrics` instance needs to be alive while there is a pending `Update()` callback to be called. Change the API to use shared_ptr, as we define a new type `SharedThreadMetrics` as `std::shared_ptr<ThreadMetrics>`. This is a breaking change but considering previous API was completely unsafe and apparently there're still no consumers I think is a good change. PR-URL: #37 Reviewed-by: Trevor Norris <trev.norris@gmail.com>
0246a12
to
a218600
Compare
trevnorris
pushed a commit
that referenced
this pull request
Dec 19, 2023
The current ThreadMetrics API is not easy to use safely because the `ThreadMetrics` instance needs to be alive while there is a pending `Update()` callback to be called. Change the API to use shared_ptr, as we define a new type `SharedThreadMetrics` as `std::shared_ptr<ThreadMetrics>`. This is a breaking change but considering previous API was completely unsafe and apparently there're still no consumers I think is a good change. PR-URL: #37 Reviewed-by: Trevor Norris <trev.norris@gmail.com>
trevnorris
pushed a commit
that referenced
this pull request
Dec 19, 2023
The current ThreadMetrics API is not easy to use safely because the `ThreadMetrics` instance needs to be alive while there is a pending `Update()` callback to be called. Change the API to use shared_ptr, as we define a new type `SharedThreadMetrics` as `std::shared_ptr<ThreadMetrics>`. This is a breaking change but considering previous API was completely unsafe and apparently there're still no consumers I think is a good change. PR-URL: #37 Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current ThreadMetrics API is not easy to use safely because the
ThreadMetrics
instance needs to be alive while there is a pendingUpdate()
callback to be called. Change the API to use shared_ptr, as we define a new typeSharedThreadMetrics
asstd::shared_ptr<ThreadMetrics>
.This is a breaking change but considering previous API was completely
unsafe and apparently there're still no consumers I think is a good
change.