Skip to content

Commit 46b11fa

Browse files
committed
Remove unused pending_threaded_processor::ids_done
1 parent b302bc0 commit 46b11fa

File tree

1 file changed

+8
-23
lines changed

1 file changed

+8
-23
lines changed

src/osmdata.cpp

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ struct pending_threaded_processor : public pending_processor
179179
using output_vec_t = std::vector<std::shared_ptr<output_t>>;
180180

181181
static void do_jobs(output_vec_t const &outputs, pending_queue_t &queue,
182-
size_t &ids_done, std::mutex &mutex, bool append,
183-
bool ways)
182+
std::mutex &mutex, bool append, bool ways)
184183
{
185184
while (true) {
186185
//get the job off the queue synchronously
@@ -200,10 +199,6 @@ struct pending_threaded_processor : public pending_processor
200199
} else {
201200
outputs.at(job.output_id)->pending_relation(job.osm_id, append);
202201
}
203-
204-
mutex.lock();
205-
++ids_done;
206-
mutex.unlock();
207202
}
208203
}
209204

@@ -228,7 +223,7 @@ struct pending_threaded_processor : public pending_processor
228223
//note that we cant hint to the stack how large it should be ahead of time
229224
//we could use a different datastructure like a deque or vector but then
230225
//the outputs the enqueue jobs would need the version check for the push(_back) method
231-
: outs(outs), ids_queued(0), append(append), queue(), ids_done(0)
226+
: outs(outs), ids_queued(0), append(append), queue()
232227
{
233228

234229
//clone all the things we need
@@ -262,9 +257,6 @@ struct pending_threaded_processor : public pending_processor
262257
//waits for the completion of all outstanding jobs
263258
void process_ways() override
264259
{
265-
//reset the number we've done
266-
ids_done = 0;
267-
268260
fmt::print(stderr, "\nGoing over pending ways...\n");
269261
fmt::print(stderr, "\t{} ways are pending\n", ids_queued);
270262
fmt::print(stderr, "\nUsing {} helper-processes\n", clones.size());
@@ -273,9 +265,9 @@ struct pending_threaded_processor : public pending_processor
273265
//make the threads and start them
274266
std::vector<std::future<void>> workers;
275267
for (auto const &clone : clones) {
276-
workers.push_back(std::async(
277-
std::launch::async, do_jobs, std::cref(clone), std::ref(queue),
278-
std::ref(ids_done), std::ref(mutex), append, true));
268+
workers.push_back(std::async(std::launch::async, do_jobs,
269+
std::cref(clone), std::ref(queue),
270+
std::ref(mutex), append, true));
279271
}
280272
workers.push_back(std::async(std::launch::async, print_stats,
281273
std::ref(queue), std::ref(mutex)));
@@ -303,7 +295,6 @@ struct pending_threaded_processor : public pending_processor
303295
ids_queued, timer.elapsed(), timer.per_second(ids_queued));
304296
}
305297
ids_queued = 0;
306-
ids_done = 0;
307298

308299
for (auto const &clone : clones) {
309300
for (auto const &clone_output : clone) {
@@ -324,9 +315,6 @@ struct pending_threaded_processor : public pending_processor
324315

325316
void process_relations() override
326317
{
327-
//reset the number we've done
328-
ids_done = 0;
329-
330318
fmt::print(stderr, "\nGoing over pending relations...\n");
331319
fmt::print(stderr, "\t{} relations are pending\n", ids_queued);
332320
fmt::print(stderr, "\nUsing {} helper-processes\n", clones.size());
@@ -335,9 +323,9 @@ struct pending_threaded_processor : public pending_processor
335323
//make the threads and start them
336324
std::vector<std::future<void>> workers;
337325
for (auto const &clone : clones) {
338-
workers.push_back(std::async(
339-
std::launch::async, do_jobs, std::cref(clone), std::ref(queue),
340-
std::ref(ids_done), std::ref(mutex), append, false));
326+
workers.push_back(std::async(std::launch::async, do_jobs,
327+
std::cref(clone), std::ref(queue),
328+
std::ref(mutex), append, false));
341329
}
342330
workers.push_back(std::async(std::launch::async, print_stats,
343331
std::ref(queue), std::ref(mutex)));
@@ -365,7 +353,6 @@ struct pending_threaded_processor : public pending_processor
365353
ids_queued, timer.elapsed(), timer.per_second(ids_queued));
366354
}
367355
ids_queued = 0;
368-
ids_done = 0;
369356

370357
//collect all expiry tree informations together into one
371358
for (auto const &clone : clones) {
@@ -394,8 +381,6 @@ struct pending_threaded_processor : public pending_processor
394381
//job queue
395382
pending_queue_t queue;
396383

397-
//how many ids within the job have been processed
398-
size_t ids_done;
399384
//so the threads can manage some of the shared state
400385
std::mutex mutex;
401386
};

0 commit comments

Comments
 (0)