-
Notifications
You must be signed in to change notification settings - Fork 30k
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: remove usage of std::shared_ptr<T>::unique()
#47315
src: remove usage of std::shared_ptr<T>::unique()
#47315
Conversation
`std::shared_ptr<T>::unique()` has been removed in C++20, so this change uses `std::shared_ptr<T>::use_count()` instead which is available in C++20. Fixes: nodejs#47311 Signed-off-by: Darshan Sen <raisinten@gmail.com>
7ea5ed1
to
409158a
Compare
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.
Based on the name, I assume that this particular function is not supposed to be thread-safe.
Correct, there's also a comment saying that - node/src/node_threadsafe_cow.h Lines 14 to 17 in 65b79ab
|
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
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.
The non-functional change LGTM but the code itself has a race condition, hasn't it?
edit: I get that it's protected by a mutex but the way that file is structured seems very prone to future mistakes.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
I don't know why the GitHub UI is showing |
`std::shared_ptr<T>::unique()` has been removed in C++20, so this change uses `std::shared_ptr<T>::use_count()` instead which is available in C++20. Fixes: #47311 Signed-off-by: Darshan Sen <raisinten@gmail.com> PR-URL: #47315 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in 1ff9824 |
`std::shared_ptr<T>::unique()` has been removed in C++20, so this change uses `std::shared_ptr<T>::use_count()` instead which is available in C++20. Fixes: #47311 Signed-off-by: Darshan Sen <raisinten@gmail.com> PR-URL: #47315 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
`std::shared_ptr<T>::unique()` has been removed in C++20, so this change uses `std::shared_ptr<T>::use_count()` instead which is available in C++20. Fixes: #47311 Signed-off-by: Darshan Sen <raisinten@gmail.com> PR-URL: #47315 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
`std::shared_ptr<T>::unique()` has been removed in C++20, so this change uses `std::shared_ptr<T>::use_count()` instead which is available in C++20. Fixes: #47311 Signed-off-by: Darshan Sen <raisinten@gmail.com> PR-URL: #47315 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
`std::shared_ptr<T>::unique()` has been removed in C++20, so this change uses `std::shared_ptr<T>::use_count()` instead which is available in C++20. Fixes: #47311 Signed-off-by: Darshan Sen <raisinten@gmail.com> PR-URL: #47315 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
`std::shared_ptr<T>::unique()` has been removed in C++20, so this change uses `std::shared_ptr<T>::use_count()` instead which is available in C++20. Fixes: #47311 Signed-off-by: Darshan Sen <raisinten@gmail.com> PR-URL: #47315 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
`std::shared_ptr<T>::unique()` has been removed in C++20, so this change uses `std::shared_ptr<T>::use_count()` instead which is available in C++20. Fixes: #47311 Signed-off-by: Darshan Sen <raisinten@gmail.com> PR-URL: #47315 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
`std::shared_ptr<T>::unique()` has been removed in C++20, so this change uses `std::shared_ptr<T>::use_count()` instead which is available in C++20. Fixes: #47311 Signed-off-by: Darshan Sen <raisinten@gmail.com> PR-URL: #47315 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
`std::shared_ptr<T>::unique()` has been removed in C++20, so this change uses `std::shared_ptr<T>::use_count()` instead which is available in C++20. Fixes: nodejs#47311 Signed-off-by: Darshan Sen <raisinten@gmail.com> PR-URL: nodejs#47315 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
std::shared_ptr<T>::unique()
has been removed in C++20, so this change usesstd::shared_ptr<T>::use_count()
instead which is available in C++20.Fixes: #47311