summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2021-11-15 20:36:23 +0100
committerTor Egge <Tor.Egge@online.no>2021-11-15 20:36:23 +0100
commitb97369cc858f131ee829c28798e24b1660d5f398 (patch)
tree23dd49a63bd47e2cb4d09c7fc4c8430899a1fb94 /searchlib
parentc33b0e408130c8151bbcd7ba00a1157afa3844ee (diff)
Use GateCallback to signal completion of push thread tasks.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/tests/memoryindex/field_index/field_index_test.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp b/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp
index ca30fe2d35e..fb779f26bfe 100644
--- a/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp
+++ b/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp
@@ -478,14 +478,20 @@ getFeatureStoreMemStats(const FieldIndexCollection &fieldIndexes)
void
myCommit(FieldIndexCollection &fieldIndexes, ISequencedTaskExecutor &pushThreads)
{
+ vespalib::Gate gate;
+ auto gate_callback = std::make_shared<vespalib::GateCallback>(gate);
uint32_t fieldId = 0;
for (auto &fieldIndex : fieldIndexes.getFieldIndexes()) {
pushThreads.execute(fieldId,
- [fieldIndex(fieldIndex.get())]()
- { fieldIndex->commit(); });
+ [fieldIndex(fieldIndex.get()), gate_callback]()
+ {
+ (void) gate_callback;
+ fieldIndex->commit();
+ });
++fieldId;
}
- pushThreads.sync_all();
+ gate_callback.reset();
+ gate.await();
}
void