From: Dodji Seketeli <dodji@seketeli.org>
To: Matthias Maennich <maennich@google.com>
Cc: libabigail@sourceware.org, gprocida@google.com,
kernel-team@android.com
Subject: Re: [PATCH v2] cleanup: std::weak_ptr use: replace manual lock by std::weak_ptr::lock
Date: Wed, 17 Jun 2020 10:00:07 +0200 [thread overview]
Message-ID: <864kraf7g8.fsf@seketeli.org> (raw)
In-Reply-To: <20200616205911.234578-1-maennich@google.com> (Matthias Maennich's message of "Tue, 16 Jun 2020 22:59:11 +0200")
Matthias Maennich <maennich@google.com> a écrit:
> The pattern
>
> expired() ? shared_ptr<T>() : shared_ptr<T>(*this)
>
> on std::weak_ptr<T> can be simplified by using std::weak_ptr<T>::lock.
> Since weak_ptr::lock does this atomically, this patch also addresses
> potential data races between the call to expired() and the construction
> based on the assumption that the shared_ptr is still around.
> Hence, apply this simplification/fix to the code base.
>
> * src/abg-comparison-priv.h (diff::priv::get_context): improve
> weak_ptr usage.
> (corpus_diff:diff_stats::priv::ctxt): Likewise.
> * src/abg-comparison.cc (corpus_diff::priv::get_context): Likewise.
> (var_diff::type_diff): Likewise.
> * src/abg-ir.cc (elf_symbol::get_next_alias): Likewise.
> (elf_symbol::get_next_common_instance): Likewise.
> (type_base::get_canonical_type): Likewise.
> (qualified_type_def::get_underlying_type): Likewise.
> (pointer_type_def::get_pointed_to_type): Likewise.
> (reference_type_def::get_pointed_to_type): Likewise.
> (array_type_def::subrange_type::get_underlying_type): Likewise.
> (array_type_def::get_element_type): Likewise.
> (typedef_decl::get_underlying_type): Likewise.
> (var_decl::get_type): Likewise.
> (function_type::get_return_type): Likewise.
> (function_decl::get_type): Likewise.
> (function_decl::parameter::get_type): Likewise.
> (class_or_union::get_naming_typedef): Likewise.
> (class_or_union::get_definition_of_declaration): Likewise.
> (class_decl::base_spec::get_base_class): Likewise.
> (template_parameter::get_enclosing_template_decl): Likewise.
> (non_type_tparameter::get_type): Likewise.
> (type_composition::get_composed_type): Likewise.
>
> Signed-off-by: Matthias Maennich <maennich@google.com>
Applied to master, thanks!
Cheers,
--
Dodji
prev parent reply other threads:[~2020-06-17 8:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-15 8:26 [PATCH] " Matthias Maennich
2020-06-15 10:49 ` Giuliano Procida
2020-06-16 20:58 ` Matthias Maennich
2020-06-16 20:59 ` [PATCH v2] " Matthias Maennich
2020-06-17 8:00 ` Dodji Seketeli [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=864kraf7g8.fsf@seketeli.org \
--to=dodji@seketeli.org \
--cc=gprocida@google.com \
--cc=kernel-team@android.com \
--cc=libabigail@sourceware.org \
--cc=maennich@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).