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.
This commit is contained in:
Tom Tromey 2022-12-27 08:58:38 -07:00
parent 9b595a2641
commit f7840e9e3e
2 changed files with 2 additions and 3 deletions

View File

@ -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<cooked_index_shard::range> result_range;
result_range.reserve (m_vector.size ());
for (auto &entry : m_vector)

View File

@ -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<cooked_index_shard::range> result_range;
result_range.reserve (m_vector.size ());
for (auto &entry : m_vector)