@@ -227,20 +227,15 @@ struct pending_threaded_processor : public pending_processor
227227 {
228228
229229 // clone all the things we need
230- clones. reserve (thread_count);
230+ m_clones. resize (thread_count);
231231 for (size_t i = 0 ; i < thread_count; ++i) {
232232 auto const midq = mid->get_query_instance ();
233233 auto copy_thread = std::make_shared<db_copy_thread_t >(
234234 outs[0 ]->get_options ()->database_options .conninfo ());
235235
236- // clone the outs
237- output_vec_t out_clones;
238236 for (auto const &out : outs) {
239- out_clones .push_back (out->clone (midq, copy_thread));
237+ m_clones[i] .push_back (out->clone (midq, copy_thread));
240238 }
241-
242- // keep the clones for a specific thread to use
243- clones.push_back (out_clones);
244239 }
245240 }
246241
@@ -260,12 +255,12 @@ struct pending_threaded_processor : public pending_processor
260255
261256 fmt::print (stderr, " \n Going over pending ways...\n " );
262257 fmt::print (stderr, " \t {} ways are pending\n " , ids_queued);
263- fmt::print (stderr, " \n Using {} helper-processes\n " , clones .size ());
258+ fmt::print (stderr, " \n Using {} helper-processes\n " , m_clones .size ());
264259 util::timer_t timer;
265260
266261 // make the threads and start them
267262 std::vector<std::future<void >> workers;
268- for (auto const &clone : clones ) {
263+ for (auto const &clone : m_clones ) {
269264 workers.push_back (std::async (std::launch::async, do_jobs,
270265 std::cref (clone), std::ref (queue),
271266 std::ref (mutex), append, true ));
@@ -296,7 +291,7 @@ struct pending_threaded_processor : public pending_processor
296291 ids_queued, timer.elapsed (), timer.per_second (ids_queued));
297292 }
298293
299- for (auto const &clone : clones ) {
294+ for (auto const &clone : m_clones ) {
300295 for (auto const &clone_output : clone) {
301296 clone_output.get ()->commit ();
302297 }
@@ -318,12 +313,12 @@ struct pending_threaded_processor : public pending_processor
318313
319314 fmt::print (stderr, " \n Going over pending relations...\n " );
320315 fmt::print (stderr, " \t {} relations are pending\n " , ids_queued);
321- fmt::print (stderr, " \n Using {} helper-processes\n " , clones .size ());
316+ fmt::print (stderr, " \n Using {} helper-processes\n " , m_clones .size ());
322317 util::timer_t timer;
323318
324319 // make the threads and start them
325320 std::vector<std::future<void >> workers;
326- for (auto const &clone : clones ) {
321+ for (auto const &clone : m_clones ) {
327322 workers.push_back (std::async (std::launch::async, do_jobs,
328323 std::cref (clone), std::ref (queue),
329324 std::ref (mutex), append, false ));
@@ -355,7 +350,7 @@ struct pending_threaded_processor : public pending_processor
355350 }
356351
357352 // collect all expiry tree informations together into one
358- for (auto const &clone : clones ) {
353+ for (auto const &clone : m_clones ) {
359354 // for each clone/original output
360355 for (output_vec_t ::const_iterator original_output = outs.begin (),
361356 clone_output = clone.begin ();
@@ -371,7 +366,7 @@ struct pending_threaded_processor : public pending_processor
371366
372367private:
373368 // output copies, one vector per thread
374- std::vector<output_vec_t > clones ;
369+ std::vector<output_vec_t > m_clones ;
375370 output_vec_t
376371 outs; // would like to move ownership of outs to osmdata_t and middle passed to output_t instead of owned by it
377372 // appending to output that is already there (diff processing)
0 commit comments