|
|
|
@@ -66,6 +66,7 @@ extern "C" {
|
|
|
|
|
|
|
|
|
|
pthread_mutex_t db_lock = PTHREAD_MUTEX_INITIALIZER;
|
|
|
|
|
pthread_mutex_t var_lock = PTHREAD_MUTEX_INITIALIZER;
|
|
|
|
|
pthread_mutex_t task_lock = PTHREAD_MUTEX_INITIALIZER;
|
|
|
|
|
|
|
|
|
|
// convert serial feature geometry (drawvec) to output tile geometry (mvt_geometry)
|
|
|
|
|
static std::vector<mvt_geometry> to_feature(drawvec const &geom) {
|
|
|
|
@@ -541,6 +542,7 @@ struct simplification_worker_arg {
|
|
|
|
|
drawvec *shared_nodes;
|
|
|
|
|
node *shared_nodes_map;
|
|
|
|
|
size_t nodepos;
|
|
|
|
|
std::string const *shared_nodes_bloom;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// If a polygon has collapsed away to nothing during polygon cleaning,
|
|
|
|
@@ -590,7 +592,7 @@ static drawvec revive_polygon(drawvec &geom, double area, int z, int detail) {
|
|
|
|
|
// This simplifies the geometry of one feature. It is generally called from the feature_simplification_worker
|
|
|
|
|
// but is broken out here so that it can be called from earlier in write_tile if coalesced geometries build up
|
|
|
|
|
// too much in memory.
|
|
|
|
|
static double simplify_feature(serial_feature *p, drawvec const &shared_nodes, node *shared_nodes_map, size_t nodepos) {
|
|
|
|
|
static double simplify_feature(serial_feature *p, drawvec const &shared_nodes, node *shared_nodes_map, size_t nodepos, std::string const &shared_nodes_bloom) {
|
|
|
|
|
drawvec geom = p->geometry;
|
|
|
|
|
signed char t = p->t;
|
|
|
|
|
int z = p->z;
|
|
|
|
@@ -637,13 +639,13 @@ static double simplify_feature(serial_feature *p, drawvec const &shared_nodes, n
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// continues to simplify to line_detail even if we have extra detail
|
|
|
|
|
drawvec ngeom = simplify_lines(geom, z, p->tx, p->ty, line_detail, !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), p->simplification, t == VT_POLYGON ? 4 : 0, shared_nodes, shared_nodes_map, nodepos);
|
|
|
|
|
drawvec ngeom = simplify_lines(geom, z, p->tx, p->ty, line_detail, !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), p->simplification, t == VT_POLYGON ? 4 : 0, shared_nodes, shared_nodes_map, nodepos, shared_nodes_bloom);
|
|
|
|
|
|
|
|
|
|
if (p->coalesced && prevent[P_SIMPLIFY_SHARED_NODES]) {
|
|
|
|
|
// do another simplification to eliminate collinearities
|
|
|
|
|
// that were left behind at the former corners between
|
|
|
|
|
// coalesced geometries
|
|
|
|
|
ngeom = simplify_lines(ngeom, z, p->tx, p->ty, line_detail, !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), 0.1, t == VT_POLYGON ? 4 : 0, shared_nodes, NULL, 0);
|
|
|
|
|
ngeom = simplify_lines(ngeom, z, p->tx, p->ty, line_detail, !(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), 0.1, t == VT_POLYGON ? 4 : 0, shared_nodes, NULL, 0, "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (t != VT_POLYGON || ngeom.size() >= 3) {
|
|
|
|
@@ -671,7 +673,7 @@ static void *simplification_worker(void *v) {
|
|
|
|
|
for (size_t i = a->task; i < (*features).size(); i += a->tasks) {
|
|
|
|
|
double area = 0;
|
|
|
|
|
if (!a->trying_to_stop_early) {
|
|
|
|
|
area = simplify_feature(&((*features)[i]), *(a->shared_nodes), a->shared_nodes_map, a->nodepos);
|
|
|
|
|
area = simplify_feature(&((*features)[i]), *(a->shared_nodes), a->shared_nodes_map, a->nodepos, *(a->shared_nodes_bloom));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
signed char t = (*features)[i].t;
|
|
|
|
@@ -832,6 +834,10 @@ static unsigned long long calculate_drop_sequence(serial_feature const &sf) {
|
|
|
|
|
return ~out; // lowest numbered feature gets dropped first
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct task {
|
|
|
|
|
int fileno = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// This is the block of parameters that are passed to write_tile() to read a tile
|
|
|
|
|
// from the serialized form, do whatever needs to be done to it, and to write the
|
|
|
|
|
// MVT-format output to the output tileset.
|
|
|
|
@@ -840,7 +846,8 @@ static unsigned long long calculate_drop_sequence(serial_feature const &sf) {
|
|
|
|
|
// by the caller to determine whether the zoom level needs to be done over with
|
|
|
|
|
// new thresholds.
|
|
|
|
|
struct write_tile_args {
|
|
|
|
|
struct task *tasks = NULL;
|
|
|
|
|
int threadno;
|
|
|
|
|
std::vector<task *> *tasks;
|
|
|
|
|
char *global_stringpool = NULL;
|
|
|
|
|
int min_detail = 0;
|
|
|
|
|
sqlite3 *outdb = NULL;
|
|
|
|
@@ -896,6 +903,7 @@ struct write_tile_args {
|
|
|
|
|
bool compressed;
|
|
|
|
|
node *shared_nodes_map;
|
|
|
|
|
size_t nodepos;
|
|
|
|
|
std::string const *shared_nodes_bloom;
|
|
|
|
|
std::set<zxy> const *skip_children; // what is being skipped at this zoom
|
|
|
|
|
std::set<zxy> skip_children_out; // what will be skipped in the next zoom
|
|
|
|
|
};
|
|
|
|
@@ -1534,7 +1542,7 @@ void skip_tile(decompressor *geoms, std::atomic<long long> *geompos_in, bool com
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, char *global_stringpool, int z, const unsigned tx, const unsigned ty, const int detail, int min_detail, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, compressor **geomfile, std::atomic<long long> *geompos, int minzoom, int maxzoom, double todo, std::atomic<long long> *along, long long alongminus, double gamma, int child_shards, long long *pool_off, unsigned *initial_x, unsigned *initial_y, std::atomic<int> *running, double simplification, std::vector<std::map<std::string, layermap_entry>> *layermaps, std::vector<std::vector<std::string>> *layer_unmaps, size_t tiling_seg, size_t pass, unsigned long long mingap, long long minextent, unsigned long long mindrop_sequence, const char *prefilter, const char *postfilter, json_object *filter, write_tile_args *arg, atomic_strategy *strategy_out, bool compressed_input, node *shared_nodes_map, size_t nodepos, std::vector<std::string> const &unidecode_data, long long estimated_complexity, std::set<zxy> &skip_children_out) {
|
|
|
|
|
long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, char *global_stringpool, int z, const unsigned tx, const unsigned ty, const int detail, int min_detail, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, compressor **geomfile, std::atomic<long long> *geompos, int minzoom, int maxzoom, double todo, std::atomic<long long> *along, long long alongminus, double gamma, int child_shards, long long *pool_off, unsigned *initial_x, unsigned *initial_y, std::atomic<int> *running, double simplification, std::vector<std::map<std::string, layermap_entry>> *layermaps, std::vector<std::vector<std::string>> *layer_unmaps, size_t tiling_seg, size_t pass, unsigned long long mingap, long long minextent, unsigned long long mindrop_sequence, const char *prefilter, const char *postfilter, json_object *filter, write_tile_args *arg, atomic_strategy *strategy_out, bool compressed_input, node *shared_nodes_map, size_t nodepos, std::string const &shared_nodes_bloom, std::vector<std::string> const &unidecode_data, long long estimated_complexity, std::set<zxy> &skip_children_out) {
|
|
|
|
|
double merge_fraction = 1;
|
|
|
|
|
double mingap_fraction = 1;
|
|
|
|
|
double minextent_fraction = 1;
|
|
|
|
@@ -2048,7 +2056,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
|
|
|
|
// may not be very effective for reducing memory usage.
|
|
|
|
|
|
|
|
|
|
for (; simplified_geometry_through < features.size(); simplified_geometry_through++) {
|
|
|
|
|
simplify_feature(&features[simplified_geometry_through], shared_nodes, shared_nodes_map, nodepos);
|
|
|
|
|
simplify_feature(&features[simplified_geometry_through], shared_nodes, shared_nodes_map, nodepos, shared_nodes_bloom);
|
|
|
|
|
|
|
|
|
|
if (features[simplified_geometry_through].t == VT_POLYGON) {
|
|
|
|
|
drawvec to_clean = features[simplified_geometry_through].geometry;
|
|
|
|
@@ -2125,6 +2133,10 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
|
|
|
|
if (lead_features_count > 0) {
|
|
|
|
|
scaled_max_tile_size *= (lead_features_count + other_multiplier_cluster_features_count) / lead_features_count;
|
|
|
|
|
}
|
|
|
|
|
size_t scaled_max_tile_features = max_tile_features;
|
|
|
|
|
if (lead_features_count > 0) {
|
|
|
|
|
scaled_max_tile_features *= (lead_features_count + other_multiplier_cluster_features_count) / lead_features_count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Operations on the features within each layer:
|
|
|
|
|
//
|
|
|
|
@@ -2243,6 +2255,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
|
|
|
|
args[i].shared_nodes = &shared_nodes;
|
|
|
|
|
args[i].shared_nodes_map = shared_nodes_map;
|
|
|
|
|
args[i].nodepos = nodepos;
|
|
|
|
|
args[i].shared_nodes_bloom = &shared_nodes_bloom;
|
|
|
|
|
args[i].trying_to_stop_early = trying_to_stop_early;
|
|
|
|
|
|
|
|
|
|
if (tasks > 1) {
|
|
|
|
@@ -2322,7 +2335,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
|
|
|
|
if (!(prevent[P_SIMPLIFY] || (z == maxzoom && prevent[P_SIMPLIFY_LOW]))) {
|
|
|
|
|
// XXX revisit: why does this not take zoom into account?
|
|
|
|
|
layer_features[x].geometry = simplify_lines(layer_features[x].geometry, 32, 0, 0, 0,
|
|
|
|
|
!(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), simplification, layer_features[x].t == VT_POLYGON ? 4 : 0, shared_nodes, NULL, 0);
|
|
|
|
|
!(prevent[P_CLIPPING] || prevent[P_DUPLICATION]), simplification, layer_features[x].t == VT_POLYGON ? 4 : 0, shared_nodes, NULL, 0, "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -2465,13 +2478,13 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (totalsize > 0 && tile.layers.size() > 0) {
|
|
|
|
|
if (totalsize > max_tile_features && !prevent[P_FEATURE_LIMIT]) {
|
|
|
|
|
if (totalsize > scaled_max_tile_features && !prevent[P_FEATURE_LIMIT]) {
|
|
|
|
|
if (totalsize > arg->feature_count_out) {
|
|
|
|
|
arg->feature_count_out = totalsize;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!quiet) {
|
|
|
|
|
fprintf(stderr, "tile %d/%u/%u has %zu features, >%zu \n", z, tx, ty, totalsize, max_tile_features);
|
|
|
|
|
fprintf(stderr, "tile %d/%u/%u has %zu features, >%zu \n", z, tx, ty, totalsize, scaled_max_tile_features);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (trying_to_stop_early && line_detail == first_detail) {
|
|
|
|
@@ -2497,7 +2510,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
|
|
|
|
line_detail++; // to keep it the same when the loop decrements it
|
|
|
|
|
continue;
|
|
|
|
|
} else if (mingap < ULONG_MAX && (additional[A_DROP_DENSEST_AS_NEEDED] || additional[A_COALESCE_DENSEST_AS_NEEDED] || additional[A_CLUSTER_DENSEST_AS_NEEDED])) {
|
|
|
|
|
mingap_fraction = mingap_fraction * max_tile_features / totalsize * 0.80;
|
|
|
|
|
mingap_fraction = mingap_fraction * scaled_max_tile_features / totalsize * 0.80;
|
|
|
|
|
unsigned long long m = choose_mingap(gaps, mingap_fraction, mingap);
|
|
|
|
|
if (m != mingap) {
|
|
|
|
|
mingap = m;
|
|
|
|
@@ -2512,7 +2525,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
} else if (additional[A_DROP_SMALLEST_AS_NEEDED] || additional[A_COALESCE_SMALLEST_AS_NEEDED]) {
|
|
|
|
|
minextent_fraction = minextent_fraction * max_tile_features / totalsize * 0.75;
|
|
|
|
|
minextent_fraction = minextent_fraction * scaled_max_tile_features / totalsize * 0.75;
|
|
|
|
|
long long m = choose_minextent(extents, minextent_fraction, minextent);
|
|
|
|
|
if (m != minextent) {
|
|
|
|
|
minextent = m;
|
|
|
|
@@ -2530,7 +2543,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
|
|
|
|
// The 95% is a guess to avoid too many retries
|
|
|
|
|
// and probably actually varies based on how much duplicated metadata there is
|
|
|
|
|
|
|
|
|
|
mindrop_sequence_fraction = mindrop_sequence_fraction * max_tile_features / totalsize * 0.95;
|
|
|
|
|
mindrop_sequence_fraction = mindrop_sequence_fraction * scaled_max_tile_features / totalsize * 0.95;
|
|
|
|
|
unsigned long long m = choose_mindrop_sequence(drop_sequences, mindrop_sequence_fraction, mindrop_sequence);
|
|
|
|
|
if (m != mindrop_sequence) {
|
|
|
|
|
mindrop_sequence = m;
|
|
|
|
@@ -2588,6 +2601,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
|
|
|
|
|
|
|
|
|
if (trying_to_stop_early && line_detail == first_detail) {
|
|
|
|
|
// didn't work, try a lower detail
|
|
|
|
|
detail_reduced++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -2694,17 +2708,35 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct task {
|
|
|
|
|
int fileno = 0;
|
|
|
|
|
struct task *next = NULL;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void *run_thread(void *vargs) {
|
|
|
|
|
write_tile_args *arg = (write_tile_args *) vargs;
|
|
|
|
|
struct task *task;
|
|
|
|
|
int *err_or_null = NULL;
|
|
|
|
|
|
|
|
|
|
for (task = arg->tasks; task != NULL; task = task->next) {
|
|
|
|
|
while (true) {
|
|
|
|
|
bool done = false;
|
|
|
|
|
|
|
|
|
|
if (pthread_mutex_lock(&task_lock) != 0) {
|
|
|
|
|
perror("pthread_mutex_lock");
|
|
|
|
|
exit(EXIT_PTHREAD);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct task *task;
|
|
|
|
|
if (arg->tasks->size() == 0) {
|
|
|
|
|
done = true;
|
|
|
|
|
} else {
|
|
|
|
|
task = arg->tasks->back();
|
|
|
|
|
arg->tasks->pop_back();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pthread_mutex_unlock(&task_lock) != 0) {
|
|
|
|
|
perror("pthread_mutex_unlock");
|
|
|
|
|
exit(EXIT_PTHREAD);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (done) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int j = task->fileno;
|
|
|
|
|
|
|
|
|
|
if (arg->geomfd[j] < 0) {
|
|
|
|
@@ -2772,7 +2804,7 @@ exit(EXIT_IMPOSSIBLE);
|
|
|
|
|
skip_tile(&dc, &geompos, arg->compressed);
|
|
|
|
|
len = 1;
|
|
|
|
|
} else {
|
|
|
|
|
len = write_tile(&dc, &geompos, arg->global_stringpool, z, x, y, z == arg->maxzoom ? arg->full_detail : arg->low_detail, arg->min_detail, arg->outdb, arg->outdir, arg->buffer, arg->fname, arg->geomfile, arg->geompos, arg->minzoom, arg->maxzoom, arg->todo, arg->along, geompos, arg->gamma, arg->child_shards, arg->pool_off, arg->initial_x, arg->initial_y, arg->running, arg->simplification, arg->layermaps, arg->layer_unmaps, arg->tiling_seg, arg->pass, arg->mingap, arg->minextent, arg->mindrop_sequence, arg->prefilter, arg->postfilter, arg->filter, arg, arg->strategy, arg->compressed, arg->shared_nodes_map, arg->nodepos, (*arg->unidecode_data), estimated_complexity, arg->skip_children_out);
|
|
|
|
|
len = write_tile(&dc, &geompos, arg->global_stringpool, z, x, y, z == arg->maxzoom ? arg->full_detail : arg->low_detail, arg->min_detail, arg->outdb, arg->outdir, arg->buffer, arg->fname, arg->geomfile, arg->geompos, arg->minzoom, arg->maxzoom, arg->todo, arg->along, geompos, arg->gamma, arg->child_shards, arg->pool_off, arg->initial_x, arg->initial_y, arg->running, arg->simplification, arg->layermaps, arg->layer_unmaps, arg->tiling_seg, arg->pass, arg->mingap, arg->minextent, arg->mindrop_sequence, arg->prefilter, arg->postfilter, arg->filter, arg, arg->strategy, arg->compressed, arg->shared_nodes_map, arg->nodepos, *(arg->shared_nodes_bloom), (*arg->unidecode_data), estimated_complexity, arg->skip_children_out);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pthread_mutex_lock(&var_lock) != 0) {
|
|
|
|
@@ -2838,7 +2870,7 @@ exit(EXIT_IMPOSSIBLE);
|
|
|
|
|
return err_or_null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::atomic<unsigned> *midx, std::atomic<unsigned> *midy, int &maxzoom, int minzoom, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, const char *tmpdir, double gamma, int full_detail, int low_detail, int min_detail, long long *pool_off, unsigned *initial_x, unsigned *initial_y, double simplification, double maxzoom_simplification, std::vector<std::map<std::string, layermap_entry>> &layermaps, const char *prefilter, const char *postfilter, std::unordered_map<std::string, attribute_op> const *attribute_accum, json_object *filter, std::vector<strategy> &strategies, int iz, node *shared_nodes_map, size_t nodepos, int basezoom, double droprate, std::vector<std::string> const &unidecode_data) {
|
|
|
|
|
int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::atomic<unsigned> *midx, std::atomic<unsigned> *midy, int &maxzoom, int minzoom, sqlite3 *outdb, const char *outdir, int buffer, const char *fname, const char *tmpdir, double gamma, int full_detail, int low_detail, int min_detail, long long *pool_off, unsigned *initial_x, unsigned *initial_y, double simplification, double maxzoom_simplification, std::vector<std::map<std::string, layermap_entry>> &layermaps, const char *prefilter, const char *postfilter, std::unordered_map<std::string, attribute_op> const *attribute_accum, json_object *filter, std::vector<strategy> &strategies, int iz, node *shared_nodes_map, size_t nodepos, std::string const &shared_nodes_bloom, int basezoom, double droprate, std::vector<std::string> const &unidecode_data) {
|
|
|
|
|
last_progress = 0;
|
|
|
|
|
|
|
|
|
|
// The existing layermaps are one table per input thread.
|
|
|
|
@@ -2931,24 +2963,7 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::
|
|
|
|
|
std::vector<task> tasks;
|
|
|
|
|
tasks.resize(TEMP_FILES);
|
|
|
|
|
|
|
|
|
|
struct dispatch {
|
|
|
|
|
struct task *tasks = NULL;
|
|
|
|
|
long long todo = 0;
|
|
|
|
|
struct dispatch *next = NULL;
|
|
|
|
|
};
|
|
|
|
|
std::vector<dispatch> dispatches;
|
|
|
|
|
dispatches.resize(threads);
|
|
|
|
|
|
|
|
|
|
dispatch *dispatch_head = &dispatches[0];
|
|
|
|
|
for (size_t j = 0; j < threads; j++) {
|
|
|
|
|
dispatches[j].tasks = NULL;
|
|
|
|
|
dispatches[j].todo = 0;
|
|
|
|
|
if (j + 1 < threads) {
|
|
|
|
|
dispatches[j].next = &dispatches[j + 1];
|
|
|
|
|
} else {
|
|
|
|
|
dispatches[j].next = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
std::vector<task *> dispatch;
|
|
|
|
|
|
|
|
|
|
for (size_t j = 0; j < TEMP_FILES; j++) {
|
|
|
|
|
if (geom_size[j] == 0) {
|
|
|
|
@@ -2956,22 +2971,7 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tasks[j].fileno = j;
|
|
|
|
|
tasks[j].next = dispatch_head->tasks;
|
|
|
|
|
dispatch_head->tasks = &tasks[j];
|
|
|
|
|
dispatch_head->todo += geom_size[j];
|
|
|
|
|
|
|
|
|
|
dispatch *here = dispatch_head;
|
|
|
|
|
dispatch_head = dispatch_head->next;
|
|
|
|
|
|
|
|
|
|
dispatch **d;
|
|
|
|
|
for (d = &dispatch_head; *d != NULL; d = &((*d)->next)) {
|
|
|
|
|
if (here->todo < (*d)->todo) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
here->next = *d;
|
|
|
|
|
*d = here;
|
|
|
|
|
dispatch.push_back(&tasks[j]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int err = INT_MAX;
|
|
|
|
@@ -2993,7 +2993,11 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::
|
|
|
|
|
atomic_strategy strategy;
|
|
|
|
|
skip_children_out.clear();
|
|
|
|
|
|
|
|
|
|
// must be recreate with each pass, since child threads consume it
|
|
|
|
|
std::vector<task *> pass_dispatch = dispatch;
|
|
|
|
|
|
|
|
|
|
for (size_t thread = 0; thread < threads; thread++) {
|
|
|
|
|
args[thread].threadno = thread;
|
|
|
|
|
args[thread].global_stringpool = global_stringpool;
|
|
|
|
|
args[thread].min_detail = min_detail;
|
|
|
|
|
args[thread].outdb = outdb; // locked with db_lock
|
|
|
|
@@ -3045,7 +3049,7 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::
|
|
|
|
|
args[thread].filter = filter;
|
|
|
|
|
args[thread].unidecode_data = &unidecode_data;
|
|
|
|
|
|
|
|
|
|
args[thread].tasks = dispatches[thread].tasks;
|
|
|
|
|
args[thread].tasks = &pass_dispatch;
|
|
|
|
|
args[thread].running = &running;
|
|
|
|
|
args[thread].pass = pass;
|
|
|
|
|
args[thread].wrote_zoom = -1;
|
|
|
|
@@ -3055,6 +3059,7 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *global_stringpool, std::
|
|
|
|
|
args[thread].compressed = (z != iz);
|
|
|
|
|
args[thread].shared_nodes_map = shared_nodes_map;
|
|
|
|
|
args[thread].nodepos = nodepos;
|
|
|
|
|
args[thread].shared_nodes_bloom = &shared_nodes_bloom;
|
|
|
|
|
args[thread].skip_children = &skip_children;
|
|
|
|
|
args[thread].skip_children_out.clear();
|
|
|
|
|
|
|
|
|
|