From: Tom Tromey Date: Tue, 27 Dec 2022 15:58:38 +0000 (-0700) Subject: Change how cooked index waits for threads X-Git-Tag: binutils-2_42~188 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f7840e9e3eb9d1a157eaae772ea6841f1b83f1ba;p=thirdparty%2Fbinutils-gdb.git Change how cooked index waits for threads This changes the cooked index code to wait for threads in its public-facing API. That is, the waits are done in cooked_index now, and never in the cooked_index_shard. Centralizing this decision makes it easier to wait for other events here as well. --- diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c index ba77f9cb373..7588b5c2896 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -409,8 +409,6 @@ cooked_index_shard::do_finalize () cooked_index_shard::range cooked_index_shard::find (const std::string &name, bool completing) const { - wait (); - cooked_index_entry::comparison_mode mode = (completing ? cooked_index_entry::COMPLETE : cooked_index_entry::MATCH); @@ -528,6 +526,7 @@ cooked_index::get_addrmaps () const cooked_index::range cooked_index::find (const std::string &name, bool completing) const { + wait (); std::vector result_range; result_range.reserve (m_vector.size ()); for (auto &entry : m_vector) diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h index 63fed35c7f3..914a595a059 100644 --- a/gdb/dwarf2/cooked-index.h +++ b/gdb/dwarf2/cooked-index.h @@ -288,7 +288,6 @@ public: /* Return a range of all the entries. */ range all_entries () const { - wait (); return { m_entries.cbegin (), m_entries.cend () }; } @@ -461,6 +460,7 @@ public: /* Return a range of all the entries. */ range all_entries () const { + wait (); std::vector result_range; result_range.reserve (m_vector.size ()); for (auto &entry : m_vector)