|
4 | 4 | #include <future> |
5 | 5 | #include <memory> |
6 | 6 | #include <mutex> |
| 7 | +#include <stack> |
7 | 8 | #include <stdexcept> |
8 | 9 | #include <utility> |
9 | 10 | #include <vector> |
@@ -162,11 +163,18 @@ void osmdata_t::flush() const |
162 | 163 |
|
163 | 164 | namespace { |
164 | 165 |
|
165 | | -//TODO: have the main thread using the main middle to query the middle for batches of ways (configurable number) |
166 | | -//and stuffing those into the work queue, so we have a single producer multi consumer threaded queue |
167 | | -//since the fetching from middle should be faster than the processing in each backend. |
| 166 | +struct pending_job_t |
| 167 | +{ |
| 168 | + osmid_t osm_id; |
| 169 | + size_t output_id; |
| 170 | + |
| 171 | + pending_job_t() : osm_id(0), output_id(0) {} |
| 172 | + pending_job_t(osmid_t id, size_t oid) : osm_id(id), output_id(oid) {} |
| 173 | +}; |
| 174 | + |
| 175 | +using pending_queue_t = std::stack<pending_job_t>; |
168 | 176 |
|
169 | | -struct pending_threaded_processor : public middle_t::pending_processor |
| 177 | +struct pending_threaded_processor : public pending_processor |
170 | 178 | { |
171 | 179 | using output_vec_t = std::vector<std::shared_ptr<output_t>>; |
172 | 180 |
|
@@ -241,7 +249,7 @@ struct pending_threaded_processor : public middle_t::pending_processor |
241 | 249 | } |
242 | 250 | } |
243 | 251 |
|
244 | | - void enqueue_ways(osmid_t id) override |
| 252 | + void enqueue_way(osmid_t id) override |
245 | 253 | { |
246 | 254 | for (size_t i = 0; i < outs.size(); ++i) { |
247 | 255 | if (outs[i]->need_forward_dependencies()) { |
@@ -304,7 +312,7 @@ struct pending_threaded_processor : public middle_t::pending_processor |
304 | 312 | } |
305 | 313 | } |
306 | 314 |
|
307 | | - void enqueue_relations(osmid_t id) override |
| 315 | + void enqueue_relation(osmid_t id) override |
308 | 316 | { |
309 | 317 | for (size_t i = 0; i < outs.size(); ++i) { |
310 | 318 | if (outs[i]->need_forward_dependencies()) { |
|
0 commit comments